Remove Schema from Xml export via XMLPORT

josalm
Member Posts: 7
Hi,
I'm trying to remove the schema part from the xml exported by a xmlport. The objective is to only get the generated xml without the schema part. I'm about to quit this xmlport nonsense and go for a codeunit.
I tried something like this after the export, but it never finds the node i'm after <xs:schema>
my xml
I tried different Xpaths like '/My_XmlPort/xs:schema' or '/My_XmlPort/schema'.
Best regards
I'm trying to remove the schema part from the xml exported by a xmlport. The objective is to only get the generated xml without the schema part. I'm about to quit this xmlport nonsense and go for a codeunit.
I tried something like this after the export, but it never finds the node i'm after <xs:schema>
TempBlob.CreateOutStream(outstream, TextEncoding::UTF8); xmlport.Export(Xmlport::"My XmlPort", outstream); TempBlob.CreateInStream(instream, TextEncoding::UTF8); XmlDocument.ReadFrom(instream, xmldoc); xmldoc.SelectSingleNode('xs:schema', node); node.Remove();
my xml
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <My_XmlPort> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:complexType name="Quadro01" mixed="true"> <xs:sequence> <xs:element minOccurs="1" maxOccurs="unbounded" name="Q01C1De" type="xs:string" /> <xs:element minOccurs="1" maxOccurs="unbounded" name="Q01C1A" type="xs:string" /> <xs:element minOccurs="1" maxOccurs="unbounded" name="Q01C2" type="xs:string" /> </xs:sequence> </xs:complexType> <xs:complexType name="Quadro02" mixed="true"> <xs:sequence>
I tried different Xpaths like '/My_XmlPort/xs:schema' or '/My_XmlPort/schema'.
Best regards
0
Answers
-
The reason you don't find `<xs:schema>` is that `xs:` is not literally part of the element's name. Instead xs is a shorthand to a namespace defned elsewhere. You need to search for an element named `schema` in the namespace denoted by `xs`.
What are you actually doing, i.e. how do you use the xmlport to generate output?
The schema should not be part of the generated xml document, unless designed like this.
0 -
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions