Convert XML to XSLT element to rowset
Hello,
I have a web service which returns XML. I need to create an omniportlet using web service.
The xml format is not in <rowset> format, so I need to convert to rowset format.
I believe omniportlet understands only in rowset format.
So how do I convert the format from <element> to <rowset> format?
Thanks in advance.
Damian,
Develop an XSLT to convert the XML to text.
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text"/>
<xsl:template match="/transfers">
<xsl:apply-templates select="case"/>
<xsl:apply-templates select="events/event"/>
<xsl:apply-templates select="roles/role"/>
</xsl:template>
<xsl:template match="case">
INSERT INTO CASE (CASE_ID, CLOSED_FLAG) VALUES (<xsl:text
disable-output-escaping="yes">"</xsl:text><xsl:value-of select="casenumber"/><xsl:text
disable-output-escaping="yes">"</xsl:text>, <xsl:text
disable-output-escaping="yes">"</xsl:text><xsl:value-of select="closed"/><xsl:text
disable-output-escaping="yes">"</xsl:text>);
</xsl:template>
<xsl:template match="event">
INSERT INTO EVENT (EVENT_NUM, CASE_ID, DETAILS, USER) VALUES (<xsl:value-of select="eventid"/>,
<xsl:text disable-output-escaping="yes">"</xsl:text><xsl:value-of
select="casenumber"/><xsl:text disable-output-escaping="yes">"</xsl:text>, <xsl:text
disable-output-escaping="yes">"</xsl:text><xsl:value-of select="narrative"/><xsl:text
disable-output-escaping="yes">"</xsl:text>, <xsl:text
disable-output-escaping="yes">"</xsl:text><xsl:value-of select="operator"/><xsl:text
disable-output-escaping="yes">"</xsl:text>);
</xsl:template>
<xsl:template match="role">
INSERT INTO ROLES (ROLE_NUM, PARTY_ID, CASE_ID) VALUES (<xsl:value-of select="roleid"/>,
<xsl:text disable-output-escaping="yes">"</xsl:text><xsl:value-of
select="partyid"/><xsl:text disable-output-escaping="yes">"</xsl:text>, <xsl:text
disable-output-escaping="yes">"</xsl:text><xsl:value-of select="casenumber"/><xsl:text
disable-output-escaping="yes">"</xsl:text>);
</xsl:template>
</xsl:stylesheet>thanks,
Deepak
Similar Messages
-
Converting XML string to Element Type
Im receiving an XML document as a String.
I have defined an element whose message type is of the same schema as the XML String.
How can i assign this string to this element in BPEL?
im using the setVariable function as follows:
setVariableData("Customer","CustomerType", new String(received))
It does not throw an error. But im unable to retrieve any of the values from this element.
Could someone pls help me with this?The output seems to be fine and structured in the XML Format, when i pass the string to the Message Type(ie CustomerType) rather than the root node (CustomerElement).
eg: in this case i have
Customer - > CustomerType -> CustomerElement - > Name, date etc...
When i assign the string to Customer Element, it displays it as a string.
When i assign the string to CustomerType it displays it in the XML Structure.
It however throws an error when i assign an element in the data to something. -
Convert XML using XSLT mapping
Hi,
I have an XML in the following format and would want to cnvert it in the target format shown below. Kindly let me know the XSLT mapping to conert from hierarchy to flat structure.
<u><b>Source XML:</b></u>
<group Level1="Mac Tools Item Classifications">
<group Level2="6-Other Merchandise">
<group Level3="61-Racing">
<group Level4="011-Collectibles">
<group Level5="001-NASCAR"/>
<group Level5="002-NHRA"/>
<group Level5="003-Other"/>
</group>
<group Level4="012-Apparel">
<group Level5="001-Jackets"/>
<group Level5="002-Shirts"/>
<group Level5="003-Other">
<group PartNumber="SHOE823-060"/>
<group PartNumber="SHOE823-070"/>
<group PartNumber="SHOE823-080"/>
<group PartNumber="SHOE823-085"/>
<group PartNumber="SHOE823-090"/>
</group>
</group>
</group>
</group>
</group>
<u><b>Target XML:</b></u>
<Group>
<part>
<Level1/>
<Level2/>
<Level3/>
<Level4/>
<PartNumber/>
</part>
<part>
<Level1/>
<Level2/>
<Level3/>
<Level4/>
<PartNumber/>
</part>
</Group>
I am not clear how to capture level1, level 2, etc. till the end node.
Regards,
SwaroopaHI,
This is a sample
<b>
<xsl:variable name="var0_floatToString" select="user0:floatToString(/body/getQuote/inputGetQuote/@customerIDFloatAttr)"/>
<xsl:if test="@customerIDFloatAttr">
<xsl:attribute name="customerIDFloatAttr">
<xsl:value-of select="@customerIDFloatAttr"/>
</xsl:attribute>
</xsl:if>
<xsl:attribute name="customerIDAttr">
<xsl:value-of select="$var0_floatToString"/>
</xsl:attribute></b>
using <xsl:attribute name here name ="leval1" like that u can use in XSLT Mapping .
Hope it helps
Regards.,
V.Rangrajan -
Converting string to xml in xslt
Hi we are trying to convert string to xml in xslt but it is getting errored out.
We have followed the procedure mentioned at http://download.oracle.com/docs/cd/A91202_01/901_doc/appdev.901/a88894/adx04xsl.htm under the section "How Do I Convert A String to a Nodeset in XSL?".
Standard procedure mentioned by oracle is not working. Is it a known bug?Chk this thread.
Re: Regd: File Conversion to XML format -
Problem writing a XSLT to convert XML in desired format from a table having self join
Hello,
I have to write a style sheet to convert XML generated from XSQL into a different format. The query that I have is as follows.
select LEVEL depth,
'H' || hierarchy_id id,
name,
nvl2(parent_id, 'H' || parent_id, 0) parent_id,
CURSOR(select LEVEL depth,
'H' || hierarchy_id hid,
name hname,
nvl2(parent_id, 'H' || parent_id, 0) hparent_id,
decode(system_id, NULL, '0', 'S' || system_id) formatted_system_id,
system_id
from hierarchy
where parent_id = h.hierarchy_id
and system_id is not null
) as systems
from hierarchy h
where system_id is null
start with parent_id is null
connect by prior hierarchy_id = parent_id
The hierarchy table has a self join to itself. The selfjoin is on the hierarchyid and the parentid fields which is evident from the query.
Here the hierarchy table contains the parent system and also the child systems underneath. The problem is that the no. of levels that it can go deep is not fixed. The output of this in sqlplus is as follows.
Depth Hierarchyid, name parentid
1 h1 xxx <null>
2 h2 bbb h1
3 h3 ccc h2
<Cursor for systems>
hid hname hparentid formatted_system_id systemid
h4 ccc h2 s1 1
h5 ccc h2 s2 2
<Back to original data>
Depth Hierarchyid, name parentid
2 h6 ddd h1
2 h7 eee h1
The desired output required from the stylesheet is as follows
<h id=h1 name=xxx>
<h id=h2 name=bbb parentid=h1>
<h id=h3 name=ccc parentid=h2>
<h id=h4 name=fff parentid=h3 systemid=s1>
<h id=h5 name=ggg parentid=h3 systemid=s2>
</h>
</h>
<h id=h6 name=ddd parentid=h1/>
<h id=h7 name=eee parentid=h1/>
</h>
Could some one guide me as to how to get this. I did write a stylesheet which gives me the following output.
<h id=h1 name=xxx>
<h id=h2 name=bbb parentid=h1/>
<h id=h3 name=ccc parentid=h2/>
<h id=h4 name=fff parentid=h3 systemid=s1>
<h id=h5 name=ggg parentid=h3 systemid=s2>
</h>
<h id=h6 name=ddd parentid=h1/>
<h id=h7 name=eee parentid=h1/>
</h>
As you can see I am missing the closing of the tag on the 7th line in the desired format. I have written the following stylesheet.
<!-- Hierarchy.xsl: Transform ROWSET/ROW format to the required Hierarchy format. -->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<!-- Template for matching the rowset..... -->
<xsl:template match="HIERARCHY">
<HIERARCHY><xsl:apply-templates/></HIERARCHY>
</xsl:template>
<!-- Template for matching the row .... -->
<xsl:template match="HELEMENT">
<xsl:choose>
<xsl:when test="PARENT_ID=0">
<helement id="{ID}" name="{NAME}" parentid="{PARENT_ID}"/>
</xsl:when>
<xsl:when test="PARENT_ID!='0'">
<helement2 id="{ID}" name="{NAME}" parentid="{PARENT_ID}">
<xsl:for-each select="SYSTEMS/SYSTEMS_ROW">
<helement3 id="{HID}" name="{HNAME}" parentid="{HPARENT_ID}" systemid="{FORMATTED_SYSTEM_ID}">
</helement3>
</xsl:for-each>
</helement2>
</xsl:when>
<xsl:otherwise>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
Is there any way of achieving this. Any help would be appreciated. I am using XSQL to generate first the basic XML output and then applying stylesheet to achieve the desired output.
Sincerely,
DHello,
I have to write a style sheet to convert XML generated from XSQL into a different format. The query that I have is as follows.
select LEVEL depth,
'H' || hierarchy_id id,
name,
nvl2(parent_id, 'H' || parent_id, 0) parent_id,
CURSOR(select LEVEL depth,
'H' || hierarchy_id hid,
name hname,
nvl2(parent_id, 'H' || parent_id, 0) hparent_id,
decode(system_id, NULL, '0', 'S' || system_id) formatted_system_id,
system_id
from hierarchy
where parent_id = h.hierarchy_id
and system_id is not null
) as systems
from hierarchy h
where system_id is null
start with parent_id is null
connect by prior hierarchy_id = parent_id
The hierarchy table has a self join to itself. The selfjoin is on the hierarchyid and the parentid fields which is evident from the query.
Here the hierarchy table contains the parent system and also the child systems underneath. The problem is that the no. of levels that it can go deep is not fixed. The output of this in sqlplus is as follows.
Depth Hierarchyid, name parentid
1 h1 xxx <null>
2 h2 bbb h1
3 h3 ccc h2
<Cursor for systems>
hid hname hparentid formatted_system_id systemid
h4 ccc h2 s1 1
h5 ccc h2 s2 2
<Back to original data>
Depth Hierarchyid, name parentid
2 h6 ddd h1
2 h7 eee h1
The desired output required from the stylesheet is as follows
<h id=h1 name=xxx>
<h id=h2 name=bbb parentid=h1>
<h id=h3 name=ccc parentid=h2>
<h id=h4 name=fff parentid=h3 systemid=s1>
<h id=h5 name=ggg parentid=h3 systemid=s2>
</h>
</h>
<h id=h6 name=ddd parentid=h1/>
<h id=h7 name=eee parentid=h1/>
</h>
Could some one guide me as to how to get this. I did write a stylesheet which gives me the following output.
<h id=h1 name=xxx>
<h id=h2 name=bbb parentid=h1/>
<h id=h3 name=ccc parentid=h2/>
<h id=h4 name=fff parentid=h3 systemid=s1>
<h id=h5 name=ggg parentid=h3 systemid=s2>
</h>
<h id=h6 name=ddd parentid=h1/>
<h id=h7 name=eee parentid=h1/>
</h>
As you can see I am missing the closing of the tag on the 7th line in the desired format. I have written the following stylesheet.
<!-- Hierarchy.xsl: Transform ROWSET/ROW format to the required Hierarchy format. -->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<!-- Template for matching the rowset..... -->
<xsl:template match="HIERARCHY">
<HIERARCHY><xsl:apply-templates/></HIERARCHY>
</xsl:template>
<!-- Template for matching the row .... -->
<xsl:template match="HELEMENT">
<xsl:choose>
<xsl:when test="PARENT_ID=0">
<helement id="{ID}" name="{NAME}" parentid="{PARENT_ID}"/>
</xsl:when>
<xsl:when test="PARENT_ID!='0'">
<helement2 id="{ID}" name="{NAME}" parentid="{PARENT_ID}">
<xsl:for-each select="SYSTEMS/SYSTEMS_ROW">
<helement3 id="{HID}" name="{HNAME}" parentid="{HPARENT_ID}" systemid="{FORMATTED_SYSTEM_ID}">
</helement3>
</xsl:for-each>
</helement2>
</xsl:when>
<xsl:otherwise>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
Is there any way of achieving this. Any help would be appreciated. I am using XSQL to generate first the basic XML output and then applying stylesheet to achieve the desired output.
Sincerely,
D -
How to ignore prefix from XML while converting XML to csv using XSLT
Hi All,
I am trying to convert XML to csv file.
the XML i have is like....
<?xml version="1.0"?>
<bulkCmConfigDataFile xmlns:es="SpecificAttributes.3.0.xsd" xmlns:un="utranNrm.xsd" xmlns:xn="genericNrm.xsd" xmlns:gn="geranNrm.xsd" xmlns="configData.xsd">
<configData dnPrefix="Undefined">
<xn:SubNetwork id="AU_R">
<xn:SubNetwork id="H5RG_0501">
<xn:MeContext id="Firle_5070020">
<xn:ManagedElement id="1">
<un:RncFunction id="1">
<un:UtranCell id="50390303">
<un:attributes>
<un:userLabel>UtranCell 50390303</un:userLabel>
<un:cId>52383</un:cId>
<un:localCellId>50390303</un:localCellId>
<un:uarfcnUl>9613</un:uarfcnUl>
<un:uarfcnDl>10563</un:uarfcnDl>
<un:primaryScramblingCode>502</un:primaryScramblingCode>
<un:primaryCpichPower>287</un:primaryCpichPower>
<un:maximumTransmissionPower>403</un:maximumTransmissionPower>
<un:primarySchPower>-18</un:primarySchPower>
<un:secondarySchPower>-20</un:secondarySchPower>
<un:bchPower>-20</un:bchPower>
<un:lac>50301</un:lac>
<un:rac>1</un:rac>
<un:sac>52383</un:sac>
<un:utranCellIubLink>SubNetwork=AU_R,SubNetwork=H5RG_0501,MeContext=H5RG_0501,ManagedElement=1,RncFunction=1,IubLink=5039030</un:utranCellIubLink>
</un:attributes>
</un:UtranCell>
</un:RncFunction>
</xn:ManagedElement>
</xn:MeContext>
</xn:SubNetwork>
</xn:SubNetwork>
</configData>
</bulkCmConfigDataFile>now when i am using XSLT functionality to convert this XML into a csv i want ignore all the prefix from this xml like "un" , "xn" etc....
can anybody has idea how i can ignore all this value using XSLTI just dont understand why factory.setIgnoringElementContentWhitespace(true) did not work.That only does something if the XML has a DTD that enables it to know what whitespace can be ignored and what is significant. The API documentation for the method refers you to this document:
http://www.w3.org/TR/REC-xml#sec-white-space -
Getting error while converting xml to xsd
I am getting error"The table (citeinfo) cannot be the child table to itself in nested relations"
at "http://www.flame-ware.com/products/xml-2-xsd/Default.aspx", while converting
xml into xsd so i can register.
Wherever citeinfo is there it is giving error.
Please look at bold and suggest solution
thank you
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE metadata SYSTEM "http://www.fgdc.gov/metadata/fgdc-std-001-1998.dtd">
<metadata>
<idinfo>
<citation>
*<citeinfo>(1)*<origin>MRF</origin>
<pubdate>20040512</pubdate>
<pubtime>09000000</pubtime>
<title>BAS_EASEMENT</title>
<edition>1</edition>
<geoform>vector digital data</geoform>
<serinfo>
<sername>One</sername>
<issue>One</issue>
</serinfo>
<pubinfo>
<pubplace>San Jose</pubplace>
<publish>CITY</publish>
</pubinfo>
<othercit>None</othercit>
<onlink>www.mrf.com</onlink>
<lworkcit>
*<citeinfo>(2)*<pubdate>20040512</pubdate>
<pubtime>09000000</pubtime>
<edition>1</edition>
<geoform>vector digital data</geoform>
<serinfo>
<sername>One</sername>
<issue>One</issue>
</serinfo>
<pubinfo>
<pubplace>San Jose</pubplace>
<publish>CITY</publish>
</pubinfo>
<othercit>None</othercit>
<onlink>www.mrf.com</onlink>
*</citeinfo>(2)*</lworkcit>
*</citeinfo>(1)*</citation>
<descript>
<abstract>Easement</abstract>
<purpose>E911 System</purpose>
<supplinf>None</supplinf>
</descript>
<timeperd>
<timeinfo>
<sngdate>
<caldate>20040512</caldate>
<time>09000000</time>
</sngdate>
</timeinfo>
<current>publication date</current>
</timeperd>
<status>
<progress>Complete</progress>
<update>As needed</update>
</status>
<spdom>
<bounding>
<westbc>
-122.339</westbc>
<eastbc>
-121.0716</eastbc>
<northbc>
37.4900</northbc>
<southbc>
36.9086</southbc>
</bounding>
</spdom>
<keywords>
<theme>
<themekt>Easement</themekt>
<themekey>Easement</themekey>
</theme>
<place>
<placekt>San Jose</placekt>
<placekey>San Jose</placekey>
</place>
<stratum>
<stratkt>None</stratkt>
<stratkey>None</stratkey>
</stratum>
<temporal>
<tempkt>None</tempkt>
<tempkey>None</tempkey>
</temporal>
</keywords>
<accconst>None</accconst>
<useconst>None</useconst>
<ptcontac>
<cntinfo>
<cntperp>
<cntper>Earl Harris</cntper>
<cntorg>City of San Jose</cntorg>
</cntperp>
<cntpos>Project Manager</cntpos>
<cntaddr>
<addrtype>Actual Address</addrtype>
<address>801 N 1 ST</address>
<city>San Jose</city>
<state>CA</state>
<postal>90000</postal>
<country>USA</country>
</cntaddr>
<cntvoice>408.277.5626</cntvoice>
<cnttdd>408.277.5626</cnttdd>
<cntfax>408.298.8382</cntfax>
<cntemail>[email protected]</cntemail>
<hours>9-5</hours>
<cntinst>None</cntinst>
</cntinfo>
</ptcontac>
<browse>
<browsen>None</browsen>
<browsed>None</browsed>
<browset>None</browset>
</browse>
<datacred>Unknown</datacred>
<secinfo>
<secsys>FGDC</secsys>
<secclass>Confidential</secclass>
<sechandl>Confidential Information</sechandl>
</secinfo>
<native>Microsoft Windows NT Version 4.0 (Build 1381) Service Pack 6; ESRI ArcCatalog 8.3.0.800</native>
<crossref>
*<citeinfo>(3)*<origin>MRF</origin>
<pubdate>20040512</pubdate>
<pubtime>09000000</pubtime>
<title>BAS_EASEMENT</title>
<edition>1</edition>
<geoform>vector digital data</geoform>
<serinfo>
<sername>one</sername>
<issue>one</issue>
</serinfo>
<pubinfo>
<pubplace>San Jose</pubplace>
<publish>CITY</publish>
</pubinfo>
<othercit>None</othercit>
<onlink>www.mrf.com</onlink>
<lworkcit>
*<citeinfo>(*4)
<origin>MRF</origin>
<pubdate>20040512</pubdate>
<pubtime>09000000</pubtime>
<title>BAS_EASEMENT</title>
<edition>1</edition>
<geoform>vector digital data</geoform>
<serinfo>
<sername>one</sername>
<issue>one</issue>
</serinfo>
<pubinfo>
<pubplace>San Jose</pubplace>
<publish>CITY</publish>
</pubinfo>
<othercit>None</othercit>
<onlink>www.mrf.com</onlink>
*</citeinfo>(*3)
</lworkcit>
*</citeinfo*>(4)
</crossref>
</idinfo>
<dataqual>
<attracc>
<attraccr>All the related attributes are populated 100%.</attraccr>
<qattracc>
<attraccv>100%</attraccv>
<attracce>All the related attributes are populated 100%.</attracce>
</qattracc>
</attracc>
<logic>100% adjusted,modified and captured easements.</logic>
<complete>100%</complete>
<posacc>
<horizpa>
<horizpar>Easement accuracy is 2 ft for 3" pixel Orthophoto, 5 ft for 9" pixel Orthophoto.</horizpar>
<qhorizpa>
<horizpav>2 ft for 3" pixel Orthophoto, 5 ft for 9" pixel Orthophoto.</horizpav>
<horizpae>Easement accuracy is 2 ft for 3" pixel Orthophoto, 5 ft for 9" pixel Orthophoto.</horizpae>
</qhorizpa>
</horizpa>
<vertacc>
<vertaccr>Easement accuracy is 2 ft for 3" pixel Orthophoto, 5 ft for 9" pixel Orthophoto.</vertaccr>
<qvertpa>
<vertaccv>2 ft for 3" pixel Orthophoto, 5 ft for 9" pixel Orthophoto.</vertaccv>
<vertacce>Easement accuracy is 2 ft for 3" pixel Orthophoto, 5 ft for 9" pixel Orthophoto.</vertacce>
</qvertpa>
</vertacc>
</posacc>
<lineage>
<srcinfo>
<srccite>
<*citeinfo>(5)*<origin>MRF</origin>
<pubdate>20040512</pubdate>
<pubtime>09000000</pubtime>
<title>BAS_EASEMENT</title>
<edition>1</edition>
<geoform>vector digital data</geoform>
<serinfo>
<sername>one</sername>
<issue>one</issue>
</serinfo>
<pubinfo>
<pubplace>San Jose</pubplace>
<publish>CITY</publish>
</pubinfo>
<othercit>None</othercit>
<onlink>www.mrf.com</onlink>
<lworkcit>
*</citeinfo>(5*)*<citeinfo>(6)*
<origin>MRF</origin>
<pubdate>20040512</pubdate>
<pubtime>09000000</pubtime>
<title>BAS_EASEMENT</title>
<edition>1</edition>
<geoform>vector digital data</geoform>
<serinfo>
<sername>one</sername>
<issue>one</issue>
</serinfo>
<pubinfo>
<pubplace>San Jose</pubplace>
<publish>CITY</publish>
</pubinfo>
<othercit>None</othercit>
<onlink>www.mrf.com</onlink>
*</citeinfo>(5)*
</lworkcit>
*</citeinfo>(6)*
</srccite>
<srcscale>24000</srcscale>
<typesrc>FTP</typesrc>
<srctime>
<timeinfo>
<sngdate>
<caldate>20040512</caldate>
<time>09000000</time>
</sngdate>
</timeinfo>
<srccurr>publication date</srccurr>
</srctime>
<srccitea>Unknown</srccitea>
<srccontr>MGE dgn contains easement data.</srccontr>
</srcinfo>
<procstep>
<procdesc>Easement data is reprojected from NAD27 to NAD83.
Further it is adjusted as per the spatial alignment shown in MGE input dgn.</procdesc>
<srcused>Easement</srcused>
<procdate>20040512</procdate>
<proctime>09000000</proctime>
<srcprod>BAS_EASEMENT</srcprod>
<proccont>
<cntinfo>
<cntperp>
<cntper>Mahesh P Choudhury</cntper>
<cntorg>Rolta International Inc.</cntorg>
</cntperp>
<cntpos>Project Manager</cntpos>
<cntaddr>
<addrtype>mailing address</addrtype>
<address>5865 North Point Parkway</address>
<city>Alpharetta</city>
<state>GA</state>
<postal>30022</postal>
<country>USA</country>
</cntaddr>
<cntvoice>678.942.5015</cntvoice>
<cnttdd>678.942.5015</cnttdd>
<cntfax>678.942.5001</cntfax>
<cntemail>[email protected]</cntemail>
<hours>8-5</hours>
<cntinst>None</cntinst>
</cntinfo>
</proccont>
</procstep>
</lineage>
<cloud>Unknown</cloud>
</dataqual>
<spdoinfo>
<indspref>unknown</indspref>
<direct>Vector</direct>
<ptvctinf>
<sdtsterm>
<sdtstype>String</sdtstype>
<ptvctcnt>2203</ptvctcnt>
</sdtsterm>
</ptvctinf>
</spdoinfo>
<spref>
<horizsys>
<geograph>
<latres>5.5</latres>
<longres>5.5</longres>
<geogunit>Decimal degrees</geogunit>
</geograph>
<geodetic>
<horizdn>North American Datum of 1983</horizdn>
<ellips>Geodetic Reference System 80</ellips>
<semiaxis>1</semiaxis>
<denflat>2</denflat>
</geodetic>
</horizsys>
<vertdef>
<altsys>
<altdatum>North American Vertical Datum of 1988</altdatum>
<altres>0.002</altres>
<altunits>sf</altunits>
<altenc>Attribute values</altenc>
</altsys>
<depthsys>
</depthsys>
</vertdef>
</spref>
<eainfo>
<detailed>
<enttyp>
<enttypl>
BAS_EASEMENT</enttypl>
<enttypd>Contains geometry and attributes for easement segments</enttypd>
<enttypds>Data Model Dictionary</enttypds>
</enttyp>
<attr>
<attrlabl>BAS_EASEMENT_ID</attrlabl>
<attrdef>Migrated from STREET table ID column. After all the existing IDs have been migrated, assign ID #70,001 onwards for the new easement (or what ever # is available sequentially using, street centerline #) ID's.</attrdef>
<attrdefs>ESRI</attrdefs>
<attrdomv>
<udom>Sequential unique whole numbers that are automatically generated.</udom>
</attrdomv>
<begdatea>20040512</begdatea>
<enddatea>20040512</enddatea>
<attrvai>
<attrva>100</attrva>
<attrvae>Unknown</attrvae>
</attrvai>
<attrmfrq>As needed</attrmfrq>
</attr>
<attr>
<attrlabl>SURVEY_LENGTH</attrlabl>
<attrdef>Actual length of easement (international foot).This DOES take into account the State Plane Coordinate System.</attrdef>
<attrdefs>Data Model Dictionary</attrdefs>
<attrdomv>
<udom>Surveyed segment length</udom>
</attrdomv>
<begdatea>20040512</begdatea>
<enddatea>20040512</enddatea>
<attrvai>
<attrva>100</attrva>
<attrvae>Unknown</attrvae>
</attrvai>
<attrmfrq>As needed</attrmfrq>
</attr>
<attr>
<attrlabl>ROW_WIDTH</attrlabl>
<attrdef>Width of right-of-way (international feet)</attrdef>
<attrdefs>Data Model Dictionary</attrdefs>
<attrdomv>
<udom>Right-of-way width</udom>
</attrdomv>
<begdatea>20040512</begdatea>
<enddatea>20040512</enddatea>
<attrvai>
<attrva>100</attrva>
<attrvae>Updated from ROW files</attrvae>
</attrvai>
<attrmfrq>As needed</attrmfrq>
</attr>
<attr>
<attrlabl>FROM_EASEMENT_ID</attrlabl>
<attrdef>Self-referential key to BAS_EASEMENT table, that contains locational information about the easement that the easement is digitized from. "FROM" is the starting point of digitization</attrdef>
<attrdefs>Data Model Dictionary</attrdefs>
<attrdomv>
<udom>IDs of an easement to which FROM side of this easement is connected.</udom>
</attrdomv>
<begdatea>20040512</begdatea>
<enddatea>20040512</enddatea>
<attrvai>
<attrva>100</attrva>
<attrvae>Unknown</attrvae>
</attrvai>
<attrmfrq>As needed</attrmfrq>
</attr>
<attr>
<attrlabl>FROM_STREET_ID</attrlabl>
<attrdef>Foreign key to BAS_STREET_SEGMENT table, that contains locational information about street segment that the easement is digitized from. "FROM" is the starting point of digitization</attrdef>
<attrdefs>Data Model Dictionary</attrdefs>
<attrdomv>
<udom>IDs of an street segment to which FROM side of this easement is connected.</udom>
</attrdomv>
<begdatea>20040512</begdatea>
<enddatea>20040512</enddatea>
<attrvai>
<attrva>100</attrva>
<attrvae>Unknown</attrvae>
</attrvai>
<attrmfrq>As needed</attrmfrq>
</attr>
<attr>
<attrlabl>TO_EASEMENT_ID</attrlabl>
<attrdef>Self-referential key to BAS_EASEMENT table, that contains locational information about the easement that the easement is digitized to. "TO" is the ending point of digitization.</attrdef>
<attrdefs>Data Model Dictionary</attrdefs>
<attrdomv>
<udom>IDs of an easement to which TO side of this easement is closely located.</udom>
</attrdomv>
<begdatea>20040512</begdatea>
<enddatea>20040512</enddatea>
<attrvai>
<attrva>100</attrva>
<attrvae>Unknown</attrvae>
</attrvai>
<attrmfrq>As needed</attrmfrq>
</attr>
<attr>
<attrlabl>TO_STREET_ID</attrlabl>
<attrdef>Foreign key to BAS_STREET_SEGMENT table, that contains locational information about street segment that the easement is digitized to. "TO" is the ending point of digitization.</attrdef>
<attrdefs>Data Model Dictionary</attrdefs>
<attrdomv>
<udom>IDs of an street segment to which TO side of this easement is closely located.</udom>
</attrdomv>
<begdatea>20040512</begdatea>
<enddatea>20040512</enddatea>
<attrvai>
<attrva>100</attrva>
<attrvae>Unknown</attrvae>
</attrvai>
<attrmfrq>As needed</attrmfrq>
</attr>
<attr>
<attrlabl>OTH_PROCESSING_STATUS_ID</attrlabl>
<attrdef>ID of the status/result of last run batch job.</attrdef>
<attrdefs>Data Model Dictionary</attrdefs>
<attrdomv>
<udom>Migrated from PLAN_1 in MGE tables and GIS_TRACKING.MDB Access Database</udom>
</attrdomv>
<begdatea>20040512</begdatea>
<enddatea>20040512</enddatea>
<attrvai>
<attrva>100</attrva>
<attrvae>Unknown</attrvae>
</attrvai>
<attrmfrq>As needed</attrmfrq>
</attr>
<attr>
<attrlabl>MUNICIPALITY_NAME</attrlabl>
<attrdef>Name of municipality in which the easement primarily resides.</attrdef>
<attrdefs>Data Model Dictionary</attrdefs>
<attrdomv>
<codesetd>
<codesetn>MUNICIPALITY_NAME_DOMAIN</codesetn>
<codesets>Data Model Dictionary</codesets>
</codesetd>
</attrdomv>
<begdatea>20040512</begdatea>
<enddatea>20040512</enddatea>
<attrvai>
<attrva>100</attrva>
<attrvae>Updated using Municipal boundary source data.</attrvae>
</attrvai>
<attrmfrq>As needed</attrmfrq>
</attr>
<attr>
<attrlabl>RECORD_DRAWING_FLAG</attrlabl>
<attrdef>Engineering plan that has been accepted by the City of San Jose (Y or N).</attrdef>
<attrdefs>Data Model Dictionary</attrdefs>
<attrdomv>
<udom>USERNAME who last modified this record</udom>
</attrdomv>
<begdatea>20040512</begdatea>
<enddatea>20040512</enddatea>
<attrvai>
<attrva>100</attrva>
<attrvae>Updated using source data.</attrvae>
</attrvai>
<attrmfrq>As needed</attrmfrq>
</attr>
<attr>
<attrlabl>ACQUISITION_DATE</attrlabl>
<attrdef>Official date engineering plan accepted by the City of San Jose on this date</attrdef>
<attrdefs>Data Model Dictionary</attrdefs>
<attrdomv>
<udom>Date/Time stamp of last record modification</udom>
</attrdomv>
<begdatea>20040512</begdatea>
<enddatea>20040512</enddatea>
<attrvai>
<attrva>100</attrva>
<attrvae>Updated using source data.</attrvae>
</attrvai>
<attrmfrq>As needed</attrmfrq>
</attr>
<attr>
<attrlabl>GEO_MOD_DATE</attrlabl>
<attrdef>Time stamp when GEOMETRY column was last modified.</attrdef>
<attrdefs>Data Model Dictionary</attrdefs>
<attrdomv>
<udom>Time stamp when GEOMETRY column was last modified.</udom>
</attrdomv>
<begdatea>20040512</begdatea>
<enddatea>20040512</enddatea>
<attrvai>
<attrva>100</attrva>
<attrvae>Data modified date.</attrvae>
</attrvai>
<attrmfrq>As needed</attrmfrq>
</attr>
<attr>
<attrlabl>GDO_GEOMETRY</attrlabl>
<attrdef>Contains spatial data with true arc geometry.</attrdef>
<attrdefs>Data Model Dictionary</attrdefs>
<attrdomv>
<udom>Oracle Spatial Geometry Data - True Arcs</udom>
</attrdomv>
<begdatea>20040512</begdatea>
<enddatea>20040512</enddatea>
<attrvai>
<attrva>100</attrva>
<attrvae>Unknown</attrvae>
</attrvai>
<attrmfrq>As needed</attrmfrq>
</attr>
<attr>
<attrlabl>MAN_OVERRIDE</attrlabl>
<attrdef>This flag is 'N' by default. If this flag is set to 'Y' no unattended batch process will touch it ever again.</attrdef>
<attrdefs>Data Model Dictionary</attrdefs>
<attrdomv>
<udom>Flag set for batch process</udom>
</attrdomv>
<begdatea>20040512</begdatea>
<enddatea>20040512</enddatea>
<attrvai>
<attrva>100</attrva>
<attrvae>Unknown</attrvae>
</attrvai>
<attrmfrq>As needed</attrmfrq>
</attr>
<attr>
<attrlabl>MESSAGE</attrlabl>
<attrdef>Message from automated batch process to operator; can be "OK", or error message, or "to be checked", etc.</attrdef>
<attrdefs>data model dictionary</attrdefs>
<attrdomv>
<udom>GDO_GEOMETRY.LEN</udom>
</attrdomv>
<begdatea>20040512</begdatea>
<enddatea>20040512</enddatea>
<attrvai>
<attrva>100</attrva>
<attrvae>Unknown</attrvae>
</attrvai>
<attrmfrq>As needed</attrmfrq>
</attr>
<attr>
<attrlabl>OTH_PLAN_CREATED</attrlabl>
<attrdef>PLAN_1 in STREET table should be migrated to BAS_EASEMENT table OTH_PLAN_ID_CREATED column. This value should also be entered into the OTH_PLAN table PLAN_NAME column if not present.</attrdef>
<attrdefs>Data Dictionary</attrdefs>
<attrdomv>
<codesetd>
<codesetn>OTH_PLAN_DOMAIN</codesetn>
<codesets>data model dictionary</codesets>
</codesetd>
</attrdomv>
<begdatea>20040512</begdatea>
<enddatea>20040512</enddatea>
<attrvai>
<attrva>100</attrva>
<attrvae>Unknown</attrvae>
</attrvai>
<attrmfrq>As needed</attrmfrq>
</attr>
<attr>
<attrlabl>OTH_PLAN_MODIFIED</attrlabl>
<attrdef>PLAN_2 in STREET table should be migrated to BAS_EASEMENT table OTH_PLAN_ID_MODIFIED column. This value should also be entered into the OTH_PLAN table PLAN_NAME column if not present</attrdef>
<attrdefs>Data dictionary</attrdefs>
<attrdomv>
<codesetd>
<codesetn>OTH_PLAN_DOMAIN</codesetn>
<codesets>data model dictionary</codesets>
</codesetd>
</attrdomv>
<begdatea>20040512</begdatea>
<enddatea>20040512</enddatea>
<attrvai>
<attrva>100</attrva>
<attrvae>Unknown</attrvae>
</attrvai>
<attrmfrq>As needed</attrmfrq>
</attr>
<attr>
<attrlabl>LINEAGE_ID</attrlabl>
<attrdef>Artificial Numeric Identifier; Assigned to any graphical object; Unique throughout the system. Shared among tables. This column would also be used by EDL Administrator for lineage.</attrdef>
<attrdefs>Data dictionary</attrdefs>
<attrdomv>
<udom>Artificial Numeric Identifier</udom>
</attrdomv>
<begdatea>20040512</begdatea>
<enddatea>20040512</enddatea>
<attrvai>
<attrva>100</attrva>
<attrvae>Unknown</attrvae>
</attrvai>
<attrmfrq>As needed</attrmfrq>
</attr>
<attr>
<attrlabl>GDO_GEOMETRY.LEN</attrlabl>
<attrdef>Created default</attrdef>
<attrdefs>Data model</attrdefs>
<attrdomv>
<udom>unknown</udom>
</attrdomv>
<begdatea>20040512</begdatea>
<enddatea>20040512</enddatea>
<attrvai>
<attrva>100</attrva>
<attrvae>Unknown</attrvae>
</attrvai>
<attrmfrq>As needed</attrmfrq>
</attr>
</detailed>
<overview>
<eaover>Populated using MRF Tools</eaover>
<eadetcit>Various sources</eadetcit>
</overview>
</eainfo>
<distinfo>
<distrib>
<cntinfo>
<cntperp>
<cntper>Earl Harris</cntper>
<cntorg>City of San Jose</cntorg>
</cntperp>
<cntpos>Project Manager</cntpos>
<cntaddr>
<addrtype>Actual Address</addrtype>
<address>801 N 1 ST</address>
<city>San Jose</city>
<state>CA</state>
<postal>90000</postal>
<country>USA</country>
</cntaddr>
<cntvoice>408.277.5626</cntvoice>
<cnttdd>408.277.5626</cnttdd>
<cntfax>408.298.8382</cntfax>
<cntemail>[email protected]</cntemail>
<hours>9-5</hours>
<cntinst>None</cntinst>
</cntinfo>
</distrib>
<resdesc>Unknown</resdesc>
<distliab>Unknown</distliab>
<stdorder>
<digform>
<digtinfo>
<formname>GM Pro Access</formname>
<formvern>5.1</formvern>
<formspec>GM Pro 5.1</formspec>
<formcont>Easement data</formcont>
<filedec>no compression applied</filedec>
<transize>60</transize>
</digtinfo>
<digtopt>
<onlinopt>
<computer>
<networka>
<networkr>FTP</networkr>
</networka>
</computer>
<accinstr>FTP</accinstr>
<oncomp>FTP server</oncomp>
</onlinopt>
<offoptn>
<offmedia>None</offmedia>
<reccap>
<recden>1</recden>
<recdenu>None</recdenu>
</reccap>
<recfmt>None</recfmt>
<compat>None</compat>
</offoptn>
</digtopt>
</digform>
<fees>Unknown</fees>
<ordering>Unknown</ordering>
<turnarnd>Unknown</turnarnd>
</stdorder>
<custom>Unknown</custom>
<techpreq>Unknown</techpreq>
<availabl>
<timeinfo>
<sngdate>
<caldate>20040512</caldate>
<time>09000000</time>
</sngdate>
</timeinfo>
</availabl>
</distinfo>
<metainfo>
<metd>20040512</metd>
<metrd>20040512</metrd>
<metfrd>20040519</metfrd>
<metc>
<cntinfo>
<cntperp>
<cntper>Mahesh P Choudhury</cntper>
<cntorg>Rolta International Inc</cntorg>
</cntperp>
<cntpos>Project Manager</cntpos>
<cntaddr>
<addrtype>mailing address</addrtype>
<address>5865 North Point Parkway</address>
<city>Alpharetta</city>
<state>GA</state>
<postal>30022</postal>
<country>USA</country>
</cntaddr>
<cntvoice>678.942.5015</cntvoice>
<cnttdd>678.942.5015</cnttdd>
<cntfax>678.942.5001</cntfax>
<cntemail>[email protected]</cntemail>
<hours>8-5</hours>
<cntinst>None</cntinst>
</cntinfo>
</metc>
<metstdn>FGDC Content Standards for Digital Geospatial Metadata</metstdn>
<metstdv>FGDC-STD-001-1998</metstdv>
<mettc>local time</mettc>
<metac>Unknown</metac>
<metuc>Unknown</metuc>
<metsi>
<metscs>Unknown</metscs>
<metsc>Confidential</metsc>
<metshd>Unknown</metshd>
</metsi>
<metextns>
<onlink>http://www.esri.com/metadata/esriprof80.html</onlink>
<metprof>ESRI Metadata Profile</metprof>
</metextns>
</metainfo>
</metadata>I am having error while registering as undefined element for citeinfo, timeinfo and cntinfo as shown below
Please could you help me solve.
thanks
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:complexType name="citationType">
<xs:sequence>
*<xs:element ref="citeinfo"/>*
</xs:sequence>
</xs:complexType>
SQL> BEGIN
2 DBMS_XMLSCHEMA.registerSchema(
3 SCHEMAURL => 'fgdc-std-001-1998-sect011.xsd',
4 SCHEMADOC => bfilename('XMLDIR','fgdc-std-001-1998-sect011.xsd'),
5 CSID => nls_charset_id('UTF8'));
6 END;
7 /
BEGIN
ERROR at line 1:
ORA-31154: invalid XML document
ORA-19202: Error occurred in XML processing
LSX-00021: undefined element "citeinfo"
ORA-06512: at "XDB.DBMS_XMLSCHEMA_INT", line 37
ORA-06512: at "XDB.DBMS_XMLSCHEMA", line 61
ORA-06512: at "XDB.DBMS_XMLSCHEMA", line 126
ORA-06512: at line 2
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:complexType name="timeperdType">
<xs:sequence>
*<xs:element ref="timeinfo"/> *
<xs:element ref="current"/>
</xs:sequence>
</xs:complexType>
<xs:element name="current" type="currentType">
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:complexType name="ptcontacType">
<xs:sequence>
*<xs:element ref="cntinfo"/> *
</xs:sequence>
</xs:complexType>
<xs:element name="browse" type="browseType">
<xs:annotation> -
Dear friends
For converting XML file to SAP, I used TEXT_CONVERT_XML_TO_SAP function module. In this I have some doubt. Pls clarify this.
1. I am getting run time error with type h.
2 I_FIELD_SEPERATOR = ';'
I_LINE_HEADER =
I_TAB_RAW_DATA =
I_FILENAME =
I_TOTALSIZE =
for the above parameter what are the value has to passed.
Thanks.Hi,
Take a look in this code:
*& Report z_xit_xml_check
REPORT z_xit_xml_check.
TYPE-POOLS: ixml.
DATA: BEGIN OF t_cabec OCCURS 0.
INCLUDE STRUCTURE zmmt2010.
DATA END OF t_cabec.
DATA: BEGIN OF t_item OCCURS 0.
INCLUDE STRUCTURE zmmt2011.
DATA END OF t_item.
DATA: BEGIN OF t_itemt OCCURS 0.
INCLUDE STRUCTURE zmmt2012.
DATA END OF t_itemt.
TYPES: BEGIN OF t_xml_line,
data(256) TYPE x,
END OF t_xml_line.
DATA check_item(1).
DATA check_itemt(1).
DATA: l_ixml TYPE REF TO if_ixml,
l_streamfactory TYPE REF TO if_ixml_stream_factory,
l_parser TYPE REF TO if_ixml_parser,
l_istream TYPE REF TO if_ixml_istream,
l_document TYPE REF TO if_ixml_document,
l_node TYPE REF TO if_ixml_node,
l_xmldata TYPE string.
DATA: l_elem TYPE REF TO if_ixml_element,
l_root_node TYPE REF TO if_ixml_node,
l_next_node TYPE REF TO if_ixml_node,
l_name TYPE string,
l_iterator TYPE REF TO if_ixml_node_iterator.
DATA: l_xml_table TYPE TABLE OF t_xml_line,
l_xml_line TYPE t_xml_line,
l_xml_table_size TYPE i.
DATA: l_filename TYPE string.
PARAMETERS: pa_file TYPE char1024 DEFAULT 'c:\xml.xml'.
START-OF-SELECTION.
PERFORM busca_xml.
PERFORM carrega_tabela.
*& Form get_xml_table
FORM get_xml_table CHANGING l_xml_table_size TYPE i
l_xml_table TYPE STANDARD TABLE.
Local variable declaration
DATA: l_len TYPE i,
l_len2 TYPE i,
l_tab TYPE tsfixml,
l_content TYPE string,
l_str1 TYPE string,
c_conv TYPE REF TO cl_abap_conv_in_ce,
l_itab TYPE TABLE OF string.
l_filename = pa_file.
upload a file from the client's workstation
CALL METHOD cl_gui_frontend_services=>gui_upload
EXPORTING
filename = l_filename
filetype = 'BIN'
IMPORTING
filelength = l_xml_table_size
CHANGING
data_tab = l_xml_table
EXCEPTIONS
OTHERS = 19.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDFORM. "get_xml_table
*& Form process_dom
FORM process_dom USING document TYPE REF TO if_ixml_document.
DATA: node TYPE REF TO if_ixml_node,
iterator TYPE REF TO if_ixml_node_iterator,
nodemap TYPE REF TO if_ixml_named_node_map,
attr TYPE REF TO if_ixml_node,
name TYPE string,
prefix TYPE string,
value TYPE string,
indent TYPE i,
count TYPE i,
index TYPE i.
DATA v_codcat TYPE zmmt2011-codcat.
DATA v_master_for TYPE zmmt2011-master_for.
node ?= document.
CHECK NOT node IS INITIAL.
IF node IS INITIAL. EXIT. ENDIF.
create a node iterator
iterator = node->create_iterator( ).
get current node
node = iterator->get_next( ).
loop over all nodes
WHILE NOT node IS INITIAL.
indent = node->get_height( ) * 2.
indent = indent + 20.
CASE node->get_type( ).
WHEN if_ixml_node=>co_node_element.
element node
name = node->get_name( ).
TRANSLATE name TO LOWER CASE.
IF name = 'iten'.
MOVE 'I' TO check_item.
ENDIF.
IF name = 'cabec'.
MOVE 'C' TO check_item.
ENDIF.
IF name = 'iten_texto'.
MOVE 'T' TO check_item.
ENDIF.
nodemap = node->get_attributes( ).
IF NOT nodemap IS INITIAL.
attributes
count = nodemap->get_length( ).
DO count TIMES.
index = sy-index - 1.
attr = nodemap->get_item( index ).
name = attr->get_name( ).
prefix = attr->get_namespace_prefix( ).
value = attr->get_value( ).
ENDDO.
ENDIF.
WHEN if_ixml_node=>co_node_text OR
if_ixml_node=>co_node_cdata_section.
text node
value = node->get_value( ).
IF check_item = 'C'.
TRANSLATE name TO LOWER CASE.
CASE name.
WHEN 'lifnr'. MOVE value TO t_cabec-lifnr.
WHEN 'codcat'.
MOVE value TO t_cabec-codcat.
MOVE value TO v_codcat.
WHEN 'bukrs'. MOVE value TO t_cabec-bukrs.
WHEN 'zterm'. MOVE value TO t_cabec-zterm.
WHEN 'waers'. MOVE value TO t_cabec-waers.
WHEN 'inco1'. MOVE value TO t_cabec-inco1.
WHEN 'inco2'. MOVE value TO t_cabec-inco2.
WHEN 'telf1'. MOVE value TO t_cabec-telf1.
WHEN 'verkf'. MOVE value TO t_cabec-verkf.
WHEN 'datav'.
MOVE value TO t_cabec-datav.
APPEND t_cabec.
ENDCASE.
ENDIF.
IF check_item = 'I'.
TRANSLATE name TO LOWER CASE.
CASE name.
WHEN 'master_for'.
MOVE value TO t_item-master_for.
MOVE value TO v_master_for.
WHEN 'werks'. MOVE value TO t_item-werks.
WHEN 'versao'. MOVE value TO t_item-versao.
WHEN 'matkl'. MOVE value TO t_item-matkl.
WHEN 'j_1bindus3'. MOVE value TO t_item-j_1bindus3.
WHEN 'j_1bmatuse'. MOVE value TO t_item-j_1bmatuse.
WHEN 'j_1bmatorg'. MOVE value TO t_item-j_1bmatorg.
WHEN 'j_1bnbmco1'. MOVE value TO t_item-j_1bnbmco1.
WHEN 'bsgru'. MOVE value TO t_item-bsgru.
WHEN 'ekgrp'. MOVE value TO t_item-ekgrp.
WHEN 'txz01'. MOVE value TO t_item-txz01.
WHEN 'epstp'. MOVE value TO t_item-epstp.
WHEN 'netpr'. MOVE value TO t_item-netpr.
WHEN 'peinh'. MOVE value TO t_item-peinh.
WHEN 'meins'. MOVE value TO t_item-meins.
WHEN 'plifz'. MOVE value TO t_item-plifz.
WHEN 'mwskz'. MOVE value TO t_item-mwskz.
WHEN 'steuc'.
MOVE value TO t_item-steuc.
MOVE v_codcat TO t_item-codcat.
APPEND t_item.
ENDCASE.
ENDIF.
IF check_item = 'T'.
TRANSLATE name TO LOWER CASE.
CASE name.
WHEN 'linha'. MOVE value TO t_itemt-linha.
WHEN 'txlng'. MOVE value TO t_itemt-txlng.
MOVE v_master_for TO t_itemt-master_for.
MOVE v_codcat TO t_itemt-codcat.
append t_itemt.
ENDCASE.
ENDIF.
ENDCASE.
advance to next node
node = iterator->get_next( ).
ENDWHILE.
ENDFORM. "process_dom
*& Form Busca_XML
text
--> p1 text
<-- p2 text
FORM busca_xml .
DATA: lc_mess(70) TYPE c,lv_tab.
TYPES: BEGIN OF ty_zvmsgorgtr.
INCLUDE STRUCTURE zmmt2011.
TYPES END OF ty_zvmsgorgtr.
Creating the main iXML factory
l_ixml = cl_ixml=>create( ).
Creating a stream factory
l_streamfactory = l_ixml->create_stream_factory( ).
PERFORM get_xml_table CHANGING l_xml_table_size l_xml_table.
wrap the table containing the file into a stream
l_istream = l_streamfactory->create_istream_itable( table =
l_xml_table size = l_xml_table_size ).
Creating a document
l_document = l_ixml->create_document( ).
Create a Parser
l_parser = l_ixml->create_parser( stream_factory = l_streamfactory
istream = l_istream
document = l_document ).
Parse the stream
IF l_parser->parse( ) NE 0.
IF l_parser->num_errors( ) NE 0.
DATA: parseerror TYPE REF TO if_ixml_parse_error,
str TYPE string,
i TYPE i,
count TYPE i,
index TYPE i.
count = l_parser->num_errors( ).
WRITE: count, ' parse errors have occured:'.
index = 0.
WHILE index < count.
parseerror = l_parser->get_error( index = index ).
i = parseerror->get_line( ).
WRITE: 'line: ', i.
i = parseerror->get_column( ).
WRITE: 'column: ', i.
str = parseerror->get_reason( ).
WRITE: str.
index = index + 1.
ENDWHILE.
ENDIF.
ENDIF.
ENDFORM. " Busca_XML
*& Form Carrega_Tabela
text
--> p1 text
<-- p2 text
FORM carrega_tabela .
Process the document
IF l_parser->is_dom_generating( ) EQ 'X'.
PERFORM process_dom USING l_document.
ENDIF.
ENDFORM. " Carrega_Tabela -
Problem in converting XML to XML file
Hi,
I am trying to convert xml file to another xml through command-line interface but failed.
java oracle.xml.parser.v2.oraxsl data.xml data.xsl data_new.xml
My xml and xsl files are:
1. XML file
<employee_data>
<employee_row>
<employee_number>7950</employee_number>
<employee_name>ABC</employee_name>
<employee_title>PRESIDENT</employee_title>
<manager>1111</manager>
<date_of_hire>20-JAN-93</date_of_hire>
<salary>65000</salary>
<commission>1000</commission>
<department_number>10</department_number>
</employee_row>
</employee_data>
2-1 XSL file
<?xml version="1.0" ?>
<xsl:stylesheet xsl:version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml"/>
<xsl:template match="*">
<xsl:copy>
<xsl:apply-templates>
<xsl:sort select=".//employee_name"/>
</xsl:apply-templates>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
2-2 XSL file
<?xml version = "1.0"?>
<ROWSET xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:for-each select="employee_data/employee_row">
<ROW>
<EMPNO><xsl:value-of select="employee_number"/></EMPNO>
<ENAME><xsl:value-of select="employee_name"/></ENAME>
<JOB><xsl:value-of select="employee_title"/></JOB>
<MGR><xsl:value-of select="manager"/></MGR>
<HIREDATE><xsl:value-of select="date_of_hire"/></HIREDATE>
<SAL><xsl:value-of select="salary"/></SAL>
<COMM><xsl:value-of select="commission"/></COMM>
<DEPTNO><xsl:value-of select="department_number"/></DEPTNO>
</ROW>
</xsl:for-each>
</ROWSET>
I used two xsl file to test but received same error message:
Error occurred while processing data.xsl: Error in expression: '*|/'.
Does anyone know how to fix the problem? I'll appreciate it very much for your help.
Thanks.
YiHi,
I have only tried it out with XML Spy, but anyway:
there seems to be an error in your 2-1 XSl file in line 2:
the correct stylesheet declaration is:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
You had an empty namespace and a wrong version attribute...
HTH,
Bernhard -
Importing xml with xslt in InDesign CS4
Hello All,
i need someone's help who's an expert at xml and xslt features of InDesign CS4.
i work in publication, besides our magazines we produce yearbooks with lots of repetative information fields in them. we get the data in xml fromat which we flow in to InDesign. the xml files are very simple, here's an example:
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<Root>
<Story>
<Country> Afganistan </Country>
<Company_ID>
<Company_Name> Kam Air </Company_Name>
<Company_Code> 1 </Company_Code>
<Address_text> 1205 Qalla Fatuha </Address_text>
<Address_text> P.O.Box 456 </Address_text>
<Address_text> Kabul </Address_text>
<Address_text> 22004 </Address_text>
<Address_text> Afganistan </Address_text>
<Telephone_text> Telephone: +93 20 2200 108 </Telephone_text>
<Fax_text> Fax: +93 20 2200 110 </Fax_text>
<Email_text> E-mail: [email protected] </Email_text>
<Website_text> Website: www.flykamair.com </Website_text>
<Personel_text> Abdul Raquib, chief Executive <Personel_text>
<Personelmail_text> ([email protected]) </Personelmail_text>
<Job_code> A1 </Job_code>
</Company_ID>
<Country> Albania </Country>
etc.
</Story>
</Root>
the problem is we don't want <Company_Code> and <Job_code> elements displayed in the InDesign file.
so we created an xslt file that shoud get rid of these two unwanted elements (obviously the xml file above was pointed to this xslt file)
<?xml version="1.0" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="/">
<Root>
<Story>
<Country>
<xsl:for-each select="Company_ID">
<Company_ID>
<xsl:value-of select="Company_Name"/>
<xsl:value-of select="Address"/>
<xsl:value-of select="Telephone_text"/>
<xsl:values-of select="Fax_tex"/>
<xsl:value-of select=Email_text"/>
<xsl:value-of select="Website_text"/>
<xsl:value-of select="Personel_text"/>
<xsl:value-of select="Pesronelmail_text"/>
</Company_ID>
</xsl:for-each>
</Story>
</Root>
</xsl:template>
</xsl:stylesheet>
but it doesn't work. could someone tell me what's wrong with the xslt file? or what would the correct xslt file look like?
Thanks everyone!Here's the sort of thing I mean in more detail.
First, the XML file:
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<?xml-stylesheet type="text/xsl" href="transform2.xsl"?>
<Root>
<Country>
<Country_name>Afganistan</Country_name>
<Company_ID>
<Company_Name> Kam Air </Company_Name>
<Company_Code> 1 </Company_Code>
<Address_text> 1205 Qalla Fatuha </Address_text>
<Address_text> P.O.Box 456 </Address_text>
<Address_text> Kabul </Address_text>
<Address_text> 22004 </Address_text>
<Address_text> Afganistan </Address_text>
<Telephone_text> Telephone: +93 20 2200 108 </Telephone_text>
<Fax_text> Fax: +93 20 2200 110 </Fax_text>
<Email_text> E-mail: [email protected] </Email_text>
<Website_text> Website: www.flykamair.com </Website_text>
<Personel_text> Abdul Raquib, chief Executive </Personel_text>
<Personelmail_text> ([email protected]) </Personelmail_text>
<Job_code> A1 </Job_code>
</Company_ID>
<Company_ID>
<Company_Name> Another Company </Company_Name>
<Company_Code> 2 </Company_Code>
<Address_text> Elswhere</Address_text>
<Address_text> P.O.Box 123</Address_text>
<Address_text>Another City</Address_text>
<Address_text> 22005 </Address_text>
<Address_text> Afganistan </Address_text>
<Telephone_text> Telephone: +12345678 </Telephone_text>
<Fax_text> Fax: +12345678 </Fax_text>
<Email_text> E-mail: [email protected] </Email_text>
<Website_text> Website: www.dfhdfh.com </Website_text>
<Personel_text> dfhdfhdfhdfhdfh</Personel_text>
<Personelmail_text>dfhdfhdfhdfh</Personelmail_text>
<Job_code> A2 </Job_code>
</Company_ID>
</Country>
<Country>
<Country_name>Albania</Country_name>
<Company_ID>
<Company_Name> Number 3 </Company_Name>
<Company_Code>3</Company_Code>
<Address_text>Somewhere in Albania</Address_text>
<Address_text>Freedonia Avenue</Address_text>
<Address_text>Whatever the captial of Albania is called</Address_text>
<Address_text> 88888</Address_text>
<Address_text> Albania </Address_text>
<Telephone_text> Telephone: + 666 666 666 666 </Telephone_text>
<Fax_text> Fax: + 777 777 777 777</Fax_text>
<Email_text> E-mail: [email protected] </Email_text>
<Website_text> Website: www.albaniar.com </Website_text>
<Personel_text>Ludwig Wittgenstein, chief Executive </Personel_text>
<Personelmail_text> ([email protected]) </Personelmail_text>
<Job_code> A1 </Job_code>
</Company_ID>
</Country>
</Root>
Note that I have renamed the XSL file "transform2.xsl". I have got rid of the "Story" tag, and I have nested the tags more appropriately, with a new tag "Country_name". Here's the XSL:
<?xml version="1.0" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="/">
<Root>
<xsl:for-each select="/Root/Country">
<Country>
<Country_name><xsl:value-of select="Country_name"/></Country_name>
<xsl:for-each select="Company_ID">
<Company_Name><xsl:value-of select="Company_Name"/></Company_Name>
<Address_text><xsl:value-of select="Address_text"/></Address_text>
<Telephone_text><xsl:value-of select="Telephone_text"/></Telephone_text>
<Fax_text><xsl:value-of select="Fax_text"/></Fax_text>
<Email_text><xsl:value-of select="Email_text"/></Email_text>
<Website_text><xsl:value-of select="Website_text"/></Website_text>
<Personel_text><xsl:value-of select="Personel_text"/></Personel_text>
<Personelmail_text><xsl:value-of select="Personelmail_text"/></Personelmail_text>
</xsl:for-each>
</Country>
</xsl:for-each>
</Root>
</xsl:template>
</xsl:stylesheet>
(That file should be saved as "transform2.xsl" to match the link on line 2 of the XML.)
Hope that works -- Jeremy -
Converting Schema attributes to elements
I have trouble registering a schema into Oracle. The problem seems to be that the schema defines Attributes and Oracle does not like Attributes.
Does someone have a XSL to convert schema attributes into elements?
I am able to convert the attributes in the XML data file to elements.
Any help will be appreciated
Thanks
SPThe following xml schema is from the Oracle XML guide. It has attributes in it.
I've used XMLSpy to validate my xsd before, and it indicated they where valid when indeed it was not. That is why I now use the link I sent previously.
The purchase-order XML schema is contained in file po.xsd:
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:annotation>
<xsd:documentation xml:lang="en">
Purchase order schema for Example.com.
Copyright 2000 Example.com. All rights reserved.
</xsd:documentation>
</xsd:annotation>
<xsd:element name="purchaseOrder" type="PurchaseOrderType"/>
<xsd:element name="comment" type="xsd:string"/>
<xsd:complexType name="PurchaseOrderType">
<xsd:sequence>
<xsd:element name="shipTo" type="USAddress"/>
<xsd:element name="billTo" type="USAddress"/>
<xsd:element ref="comment" minOccurs="0"/>
<xsd:element name="items" type="Items"/>
</xsd:sequence>
<xsd:attribute name="orderDate" type="xsd:date"/>
</xsd:complexType>
<xsd:complexType name="USAddress">
<xsd:sequence>
<xsd:element name="name" type="xsd:string"/>
<xsd:element name="street" type="xsd:string"/>
<xsd:element name="city" type="xsd:string"/>
<xsd:element name="state" type="xsd:string"/>
<xsd:element name="zip" type="xsd:decimal"/>
</xsd:sequence>
<xsd:attribute name="country" type="xsd:NMTOKEN" fixed="US"/>
</xsd:complexType>
<xsd:complexType name="Items">
<xsd:sequence>
<xsd:element name="item" minOccurs="0" maxOccurs="unbounded">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="productName" type="xsd:string"/>
<xsd:element name="quantity">
<xsd:simpleType>
<xsd:restriction base="xsd:positiveInteger">
<xsd:maxExclusive value="100"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="USPrice" type="xsd:decimal"/>
<xsd:element ref="comment" minOccurs="0"/>
<xsd:element name="shipDate" type="xsd:date" minOccurs="0"/>
</xsd:sequence>
<xsd:attribute name="partNum" type="SKU" use="required"/>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType> -
Converting XML in WML using XSL Processor from XMLParser v2
When trying to concert an XML doc into WML, it seems like the XSL Processor is removing some WML tags. Below are the XML doc and XSL doc I am using :
The XML DOC
<?xml version="1.0"?>
<ROWSET>
<ROW id="1">
<NAME>RestaurantName</NAME>
<ADDRESS>RestaurantAddress</ADDRESS>
<PHONE_TYPE>Fixed</PHONE_TYPE>
<PHONE>0112345678</PHONE>
<PRICE>60</PRICE>
<MENU>Salad, Pizza</MENU>
<DESCRIPTION>Very good restaurant</DESCRIPTION>
</ROW>
<ROW id="2">
<NAME>SecondRestaurantName</NAME>
<ADDRESS>SecondRestaurantAddress</ADDRESS>
<PHONE_TYPE>Fixed</PHONE_TYPE>
<PHONE>0187654321</PHONE>
<PRICE>60</PRICE>
<MENU>Salad, Fish</MENU>
<DESCRIPTION>Godd restaurant</DESCRIPTION>
</ROW>
</ROWSET>
The XSL DOC
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<WML>
<CARD>
<xsl:apply-templates/>
</CARD>
</WML>
</xsl:template>
<xsl:template match="ROWSET">
<xsl:for-each select="ROW">
<xsl:value-of select="NAME"/>
<xsl:value-of select="ADDRESS"/>
Phone : <xsl:value-of select="PHONE"/>
Price of the menu : <xsl:value-of select="PRICE"/>
You can order : <xsl:value-of select="MENU"/>
<xsl:value-of select="DESCRIPTION"/>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
The
tag are removed by the XSL Processor ; In fact it seems that any tag contained within <xsl:template match="ROWSET"> and </template> is removed. This does not occurs with other XSL processor (such as lotusxsl).
Is there something I'm doing wrong ??Your examples works correctly for me using the XSLT engine that comes with release 2.0.2.6 of the Oracle XML Parser "v2" for Java.
Are you working with this latest release? -
Convert XML to SAP internal table
Hi gurus,
My program is suppose to get current exchange rate file from website and upload it in SAP.
by using FM 'HTTP_GET', im getting the data in XML format.My problem is..i have tried to use transformation but failed to
map it against XML data element..and i have tried to use CALL FUNCTION 'SCMS_TEXT_TO_XSTRING' and then CALL FUNCTION 'SMUM_XML_PARSE' but it returns initial value with error ''line 0 col 12-unexpected symbol: '>'' .
Below is an excerpt of my XML file:
..<xml version>
..<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
.. xmlns:o="urn:schemas-microsoft-com:office:office"
.. xmlns:x="urn:schemas- microsoft-com:office:excel"
.. xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet">
.. <ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel"> <WindowHeight>10875</WindowHeight>........ <WindowWidth>13260</WindowWidth><WindowTopX>480</WindowTopX><WindowTopY>30</Wind
.. <Style ss:ID="Default" ss:Name="Normal">
.. <Alignment ss:Vertical="Bottom"/>
.. <Borders/>
.. <Font/>
.. <Interior/>
.. <NumberFormat/>
.. <Protection/>
.. </Style>
.. <Style ss:ID="BoldColumn">
.. <Font ss:FontName="Microsoft Sans Serif" x:Family="Swiss" ss:Bold="1"/>
.. <Worksheet ss:Name="Page1"><Table ss:StyleID="s21" > <Column ss:Width="130"/> <Column ss:Width="85"/> <Column .. ss:Width="85"/> <Column ss:Width="85"/> <Column ss:Widt
.. Cell><Cell ss:MergeAcross="1" ss:StyleID="BoldColumn"><Data ss:Type="String">Average Buying Rates</Data></Cell><Cell .. ss:MergeDown="1" ss:StyleID="BoldColumn"><Data ss:Type="Stri
.. ss:Type="Number">47.3732</Data></Cell><Cell ss:StyleID="Decimal"><Data ss:Type="Number">47.5374</Data></Cell><Cell .. ss:StyleID="Decimal"><Data ss:Type="Number">48.2323</Data></Ce
.. " ><Data ss:Type="String">HONG KONG</Data></Cell><Cell ss:StyleID="StringLiteralCenter" ><Data .. .. ss:Type="String">HKD</Data></Cell><Cell ss:StyleID="Decimal"><Data ss:Type="Numb
.. ss:Type="Number">22.8131</Data></Cell><Cell ss:StyleID="Decimal"><Data ss:Type="Number">23.2595</Data></Cell>.. .. </Row><Row><Cell ss:StyleID="StringLiteral" ><Data ss:Type="String"
.. ss:StyleID="StringLiteralCenter" ><Data ss:Type="String">IDR</Data></Cell><Cell ss:StyleID="Decimal"><Data .. ss:Type="Number">3.0395</Data></Cell><Cell ss:StyleID="Decimal"><Data
.. ecimal"><Data ss:Type="Number">30.6424</Data></Cell></Row><Row><Cell ss:StyleID="StringLiteral" ><Data .. ss:Type="String">AUSTRALIA</Data></Cell><Cell ss:StyleID="StringLiteralCe
.. ell ss:StyleID="Decimal"><Data ss:Type="Number">0.3392</Data></Cell><Cell ss:StyleID="Decimal"><Data .. ss:Type="Number">0.3409</Data></Cell><Cell ss:StyleID="Decimal"><Data ss:Typ
.. StringLiteral" ><Data ss:Type="String">DENMARK</Data></Cell><Cell ss:StyleID="StringLiteralCenter" ><Data .. ss:Type="String">DKK</Data></Cell><Cell ss:StyleID="Decimal"><Data ss
.. ata ss:Type="Number">4.4550</Data></Cell><Cell ss:StyleID="Decimal"><Data ss:Type="Number">4.6073</Data></Cell>.. </Row><Row></Row><Row></Row><Row><Cell ss:MergeAcross="4" ss:Style
.. s of 23 November 2010</Data></Cell></Row><Row></Row><Row><Cell ss:MergeAcross="4" .. ss:StyleID="BoldColumn_Left" ><Data ss:Type="String">2. Foreign Exchange Rates (THOMSON REUTE
.. ><Data ss:Type="String">ZAR</Data></Cell><Cell ss:StyleID="Decimal"><Data ss:Type="Number">4.2735</Data></Cell>.. <Cell ss:StyleID="Decimal"><Data ss:Type="Number">4.3125</Data></
.. ="Decimal"><Data ss:Type="Number">106.5459</Data></Cell><Cell ss:StyleID="Decimal"><Data .. ss:Type="Number">107.5164</Data></Cell></Row><Row><Cell ss:StyleID="StringLiteral" ><Da
.. a></Cell><Cell ss:StyleID="Decimal"><Data ss:Type="Number">4.6916</Data></Cell></Row><Row><Cell .. ss:StyleID="StringLiteral" ><Data ss:Type="String">BANGLADESH</Data></Cell><Cell
.. r">0.0074</Data></Cell></Row><Row><Cell ss:StyleID="StringLiteral" ><Data ss:Type="String">KENYA</Data></Cell><Cell .. ss:StyleID="StringLiteralCenter" ><Data ss:Type="String">KE
.. ><Cell ss:StyleID="StringLiteral" ><Data ss:Type="String">VIET NAM</Data></Cell><Cell ss:StyleID="StringLiteralCenter" >.. <Data ss:Type="String">VND</Data></Cell><Cell ss:StyleI
.. A</Data></Cell><Cell ss:StyleID="StringLiteralCenter" ><Data ss:Type="String">LKR</Data></Cell><Cell .. .. ss:StyleID="Decimal"><Data ss:Type="Number">0.2686</Data></Cell><Cell ss:St
.. String">OMR</Data></Cell><Cell ss:StyleID="Decimal"><Data ss:Type="Number">77.7094</Data></Cell><Cell
Please help me to translate my XML file into SAP format...i need it fixed urgently..
Edited by: Guest101 on Dec 28, 2010 12:11 PMIt has 2 part one is source code and another is the XML file
create an XML file with the data provided in the last 2.
then place it in a path mention the path in the below source.
1. Complete code for converting XML to internal table in SAP.
*& Report ZTST_PGM02
REPORT ZTST_PGM02.
Load iXML Lib.
type-pools: ixml.
class cl_ixml definition load.
data: G_IXML type ref to if_ixml.
data: STREAMFACTORY type ref to if_ixml_stream_factory.
data: ISTREAM type ref to if_ixml_istream.
data: DOCUMENT type ref to if_ixml_document.
data: PARSER type ref to if_ixml_parser.
data: LV_FILE_URL type rlgrap-filename.
You should provide the parameter for file name
LV_FILE_URL = 'D:\navps\input_xml.xml'.
types: begin of XML_LINE,
DATA(256) type x,
end of XML_LINE.
types: begin of TY_HEADER,
CUST_NAME(20) type c,
CARD_NO(20) type c,
TAX_AMOUNT(10) type c,
TOTAL_AMOUNT(10) type c,
end of TY_HEADER.
types: begin of TY_ITEM,
ITEM_NO(4) type n,
ITEM_ID(20) type c,
ITEM_TITLE(50) type c,
ITEM_QTY(10) type c,
ITEM_UPRICE(10) type c,
end of TY_ITEM.
data: GV_HEADER type TY_HEADER.
data: GT_ITEM type standard table of TY_ITEM with header line.
data: XML_TABLE type table of XML_LINE,
XML_TABLE_SIZE type i.
The next step is creating the main factory for the iXML library:
G_IXML = cl_ixml=>create( ).
Now Create Stream Factory
STREAMFACTORY = G_IXML->create_stream_factory( ).
upload a file from the client's workstation
call function 'WS_UPLOAD'
exporting
filename = LV_FILE_URL
filetype = 'BIN'
importing
filelength = XML_TABLE_SIZE
tables
data_tab = XML_TABLE
exceptions
others = 11.
wrap the table containing the file into a stream
ISTREAM = STREAMFACTORY->create_istream_itable( table = XML_TABLE
size = XML_TABLE_SIZE )
Get the file data as Stream
*istream = streamfactory->create_istream_uri( public_id = lv_file_url
system_id = lv_file_url ).
Create XML Document instance
DOCUMENT = G_IXML->create_document( ).
Create parser Object
PARSER = G_IXML->create_parser( stream_factory = STREAMFACTORY
ISTREAM = istream
DOCUMENT = document ).
Parse an XML document into a DOM tree
*parser->parse( ).
Parsing Error Processing
if PARSER->parse( ) ne 0.
if PARSER->num_errors( ) ne 0.
data: PARSEERROR type ref to if_ixml_parse_error,
STR type STRING,
I type i,
COUNT type I,
INDEX type i.
COUNT = PARSER->num_errors( ).
write: COUNT, ' parse errors have occured:'.
INDEX = 0.
while INDEX < COUNT.
PARSEERROR = PARSER->get_error( INDEX = index ).
I = PARSEERROR->get_line( ).
write: 'line: ', i.
I = PARSEERROR->get_column( ).
write: 'column: ', i.
STR = PARSEERROR->get_reason( ).
write: STR.
INDEX = index + 1.
endwhile.
endif.
endif.
Close the stream since it #s not needed anymore
call method ISTREAM->close( ).
clear ISTREAM.
Now try to make it look good
data : lv_size type sytabix,
lv_ret_code type sysubrc.
data: lo_xml_document type ref to cl_xml_document.
field-symbols: <fs_xml_data> type any table.
lo_xml_document = document.
call method lo_xml_document->get_as_table
importing
table = <fs_xml_data>
size = lv_size
retcode = lv_ret_code
*data: items type ref to if_ixml_node_collection.
*items = document->get_elements_by_tag_name( name = 'Item' ).
*data: iterator type ref to if_ixml_node_iterator,
node type ref to if_ixml_node.
*iterator = document->create_iterator( ).
*node = iterator->get_next( ).
*while not node is initial.
do something with the node
node = iterator->get_next( ).
*endwhile.
DATA : GV_NODE type ref to if_ixml_node.
DATA : GV_NODETEXT type STRING.
data: GV_FIRST_TIME.
GV_FIRST_TIME = 'X'.
GV_NODE = DOCUMENT.
GT_ITEM-item_no = 1.
perform GET_DATA tables GT_ITEM
using GV_NODE
changing GV_HEADER.
Last item is still not added.
append GT_ITEM.
write : GV_HEADER-cust_name,
GV_HEADER-card_no,
GV_HEADER-tax_amount,
GV_HEADER-total_amount.
loop at GT_ITEM.
write /:.
write : GT_ITEM-item_no,
GT_ITEM-item_id,
GT_ITEM-item_title,
GT_ITEM-item_qty,
GT_ITEM-item_uprice.
endloop.
FORM Get_data *
form get_data tables YT_ITEM structure GT_ITEM
using value(x_node) type ref to if_ixml_node
changing Y_HEADER type TY_HEADER.
data: INDENT type i.
data: PTEXT type ref to if_ixml_text.
data: STRING type string.
data: TEMP_STRING(100).
case X_NODE->get_type( ).
when if_ixml_node=>co_node_element.
STRING = X_NODE->get_name( ).
GV_NODETEXT = STRING.
when if_ixml_node=>co_node_text.
PTEXT ?= X_NODE->query_interface( IXML_IID_TEXT ).
if PTEXT->ws_only( ) is initial.
STRING = X_NODE->get_value( ).
case GV_NODETEXT.
when 'Customer'.
clear GV_HEADER.
when 'Name'.
move STRING to GV_HEADER-cust_name.
when 'Cardnum'.
move STRING to GV_HEADER-card_no.
when 'Tax'.
move STRING to GV_HEADER-tax_amount.
when 'Total'.
move STRING to GV_HEADER-total_amount.
Iteam details
when 'ID'.
move STRING to GT_ITEM-item_id.
when 'Title'.
move STRING to TEMP_STRING.
move TEMP_STRING to GT_ITEM-item_title.
when 'Quantity'.
move STRING to GT_ITEM-item_qty.
when 'UnitPrice'.
move STRING to GT_ITEM-item_uprice.
endcase.
endif.
endcase.
if GV_NODETEXT = 'Customer'.
clear GV_HEADER.
elseif GV_NODETEXT = 'Item'.
if GV_FIRST_TIME ne 'X'.
append GT_ITEM.
clear : gt_item.
GT_ITEM-item_no = gt_item-item_no + 1.
endif.
GV_FIRST_TIME = ' '.
endif.
Get the next child
X_NODE = x_node->get_first_child( ).
Recurse
while not X_NODE is initial.
perform GET_DATA tables GT_ITEM
using X_NODE
changing GV_HEADER.
X_NODE = x_node->get_next( ).
endwhile.
endform.
Create an XML file with the following DATA given below and place it in the path mentioned above source code.
2. XML File DATA. You create an XML File in this format to test the same.
<?xml version="1.0" encoding="ISO-8859-1" standalone="yes" ?>
- <Order>
- <Customer>
<Name>Bill Buckram</Name>
<Cardnum>234 234 234 234</Cardnum>
</Customer>
- <Manifest>
- <Item>
<ID>209</ID>
<Title>Duke: A Biography of the Java Evangelist</Title>
<Quantity>1</Quantity>
<UnitPrice>$10.75</UnitPrice>
</Item>
- <Item>
<ID>208</ID>
<Title>100% Pure: Making Cross Platform Deployment a Reality</Title>
<Quantity>1</Quantity>
<UnitPrice>$10.75</UnitPrice>
</Item>
- <Item>
<ID>204</ID>
<Title>Making the Transition from C++ to the Java(tm) Language</Title>
<Quantity>1</Quantity>
<UnitPrice>$10.75</UnitPrice>
</Item>
- <Item>
<ID>202</ID>
<Title>Web Servers for Fun and Profit</Title>
<Quantity>1</Quantity>
<UnitPrice>$10.75</UnitPrice>
</Item>
- <Item>
<ID>210</ID>
<Title>I Think Not: Dukes Likeness to the Federation Insignia</Title>
<Quantity>1</Quantity>
<UnitPrice>$10.75</UnitPrice>
</Item>
</Manifest>
- <Receipt>
<Subtotal>$53.75</Subtotal>
<Tax>$4.43</Tax>
<Total>$58.18</Total>
</Receipt>
</Order> -
Hi All,
Can you please let me know for any sample code in xslt/java mapping for converting XML string into XML. We use SAP Pi 7.0
My XML string starts like this
<?xml version="1.0" encoding="UTF-8" ?>
- <ns0:MT_ReceiverFileStructure <namespace>"><Output><?xml version="1.0" encoding="ISO-8859-9"?><?xml-stylesheet type="text/xsl" href="<xsl>"?><Tarih_Date Tarih="11.09.2014" Date="09/11/2014>
Thanks,
PavithraThanks Praveen. It worked.
However, the xml i have is an extract from a exchange rate URL and it has the reference to a xsl in it as below
<?xml version="1.0" encoding="ISO-8859-9"?><?xml-stylesheet type="text/xsl" href="<ABC.xsl>"?>.
So there is an error in sxmb_moni. Is it possible to remove this. -
How to convert xml file to xsl using java
Hi all,
I have an XML file with which i need to convert(transform) it to an xsl file using java.
I am new to converting xml file to xslt.Please send me if u have code .
Thanks in advance
regards
RamYou seem to be asking the wrong question. An XSL file can be used to transform an XML file, but transforming an XML into an XSL does not make sense. The API for running XSL transforms on the Java platform is described here:
http://java.sun.com/javase/6/docs/api/javax/xml/transform/package-summary.html
Maybe you are looking for
-
I can't view fullscreen videos.
-
Code problem, variable might not have been initialized..
I have a program I'm working on, I have to seperate file classes.. I have one that is mainly just the class and its functions, the other I'm triing to get to use the previously mentioned class, but it keeps telling me that my variable might not have
-
How to Map IDOC Extensions in LSMW
HI, I am working on a conversion for uploading material master using IDOC Method, There is an extension in the IDOC can anyone tell me how to map the extensions in the LSMW. ADVANCE Thanks Guhapriyan Subrahmanyam
-
I have table T_PROCESS ,here there are contains 2 columns... Process_flag Process_type 1 END DATE CHANGE:PLAN ID CHANGE 1 PLAN ID CHANGE 1 MENU OPTION INSERT 1 END DATE CHANGE:PLAN ID CHANGE:MENU OPTION INSERT 1 END DATE CHANGE:PLAN
-
Major Blunder! Is there a folder where I can find another backup?
In my haste to exit Pages, I stupidly said no to saving the document I was working on [it was an existing doc of another title and from another folder]. Now there is no backup of the new doc. I still have the original documents that I started from. I