linq to xml - xmlns="something" - must be in parent nod -


I have a problem XAttribute can not name this way: XAttribute ( "xmlns", nss.NamespaceName) < / P>

XNamespace ns = "Blur: hl7-org: v3"; XNamespace nsVoc = "Pulse: HL7-Organization: v3 / VOC";

  new XElement ( "ClinicalDocument", New XAttribute (XNamespace.Xmlns + 'xsi ", xsiNs.NamespaceName), New XAttribute (" xmlns ", nss.NamespaceName), New XAttribute (XNamespace. Xmlns + "VOC", nsVoc.NamespaceName), new XAttribute (xsiNs + "schemaLocation", ns.NamespaceName + "../Schemas/cda/Schemas/CDA .xsd"), new XElement ( "typeId", new XAttribute ( "root", rootTypeId), new XAttribute ( "detail", extensionTypeId)), new XElement ( "TemplateId" new XAttribute ( "root", rootTemplateId)), new XElement ( "template ID", new XAttribute ( "root" , Root timed id)),  

...

I am not here to close the sanction of this parent .. I

Repeated: The prefix '' to '' LR: HL 7-org: V 3 'the same can not be redefined within the first element tags.

  new XElement ( "ClinicalDocument", new XAttribute (XNamespace.Xmlns + 'xsi ", xsiNs.NamespaceName), new XAttribute (" xmlns ", Nss .Names.NamespaceName),  

You need

  XNamespace df = nss.NamespaceName; New XElement (df + "ClinicalDocument", New XAttribute (XNamespace.Xmlns + 'xsi ", xsiNs.NamespaceName), New XAttribute (XNamespace.Xmlns +" VOC ", nsVoc.NamespaceName), New XAttribute (xsiNs +" schemaLocation " Ns.Names.NamespaceName + "../Schemas/cda/Schemas/CDA.xsd"), New XElement (df + "typeId",  
one XNamespace

so you need to make sure that you For the default namespaces that were created and then your code needs to be done to ensure that the new XElement () call is used for example new xelement (df + "foo") element in the code> element.


Comments

Popular posts from this blog

apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -