Default xml namespace and attributes
Hi,
I was trying to use default xml namespaces, but came upon something strange.
I got the following piece of xml:
<animal type="sheep" xmlns="http://blabla">
<name>josh</name>
<age>2</age>
</animal>
and the following code
public static var ns:Namespace = new Namespace("http://blabla");
var xml:XML; // xml will be read into this var, not going into details here
public function myfunc():void {
default xml namespace = ns;
trace( xml.animal.@type );
now for some reason, the elements are correctly traversed using the default namespace. But the attribute isn't found. After a bit of debugging, I found that I could only retrieve the attribute when using xml.animal.attribute(new QName("", "type")). Am I doing something wrong here? Why isn't the attribute in the same default namespace as the element?
Kind regards,
Jan
The attribute should be in the element's namespace. If I run this snippet on the timeline, it outputs the correct values.
var xml:XML =
<xml>
<animal type="sheep" xmlns="http://blabla">
<name>josh</name>
<age>2</age>
</animal>
<animal type="cow" xmlns="http://blabla">
<name>jim</name>
<age>2</age>
</animal>
</xml>
var ns:Namespace = new Namespace("http://blabla");
default xml namespace = ns;
trace( xml.animal.@type ); // OUTPUT: sheepcow
Similar Messages
-
VerifyError #1025 - default xml namespace and getter function
I have narrowed the problem down to a a few lines. I have
created a simple example of the problem...
// TestClass.as
package {
import flash.events.EventDispatcher;
public class TestClass extends EventDispatcher {
private var _testVar:String;
public function TestClass() {
var testXML:XML = <node1 xmlns="
http://www.testurl.com/"><node2><node3>some
words of wisdom</node3></node2></node1>;
default xml namespace = testXML.namespace("");
_testVar = testXML.node2.node3;
public function get testVar():String {
return _testVar;
// Test.fla - frame 1
import TestClass;
var myTestClass:TestClass = new TestClass();
var someVar:String = myTestClass.testVar;
trace(someVar);
I get the following error...
verify TestClass/get testVar()
stack:
scope: [global Object$ flash.events::EventDispatcher$
TestClass$]
locals: TestClass
0:getlocal0
stack: TestClass
scope: [global Object$ flash.events::EventDispatcher$
TestClass$]
locals: TestClass
1:pushscope
stack:
scope: [global Object$ flash.events::EventDispatcher$
TestClass$] TestClass
locals: TestClass
2:getlocal1
VerifyError: Error #1025: An invalid register 1 was accessed.
at TestClass/get testVar()
at Test_fla::MainTimeline/Test_fla::frame1()
However if I take out the default xml namespace line, and
create a new namespace it will work.
var testNS:Namespace = new Namespace(testXML.namespace(""));
_testVar = testXML.testNS::node2.testNS::node3;
Thoughts??? It's driving me crazy. Thanks in advance...
leviThe attribute should be in the element's namespace. If I run this snippet on the timeline, it outputs the correct values.
var xml:XML =
<xml>
<animal type="sheep" xmlns="http://blabla">
<name>josh</name>
<age>2</age>
</animal>
<animal type="cow" xmlns="http://blabla">
<name>jim</name>
<age>2</age>
</animal>
</xml>
var ns:Namespace = new Namespace("http://blabla");
default xml namespace = ns;
trace( xml.animal.@type ); // OUTPUT: sheepcow -
Default xml namespace = v hangs app
This is probably due to my relative inexperience with Flex (using FlashBuilder 4.5 and Flex SDK 3.6) but I've got an app that is acting strangely and I'd like to find out what's wrong.
Briefly, I'm trying to parse some XML (returned from a REST service) and, within a private function, am creating a namespace (call it v). I then use the directive default xml namespace = v. However, upon trying to launch and debug the app it hangs at application startup. The default directive is in a private function (actually a function called only when my HTTP service completes) of a component. Regardless, if I comment out the default directive the application works normally.
Again, this function isn't even CALLED unless I essentially click a button to access the service, so I have absolutely no idea why it appears to be affecting the loading of my app.
I have used Google to search for "Flex default xml namespace hangs app" but have found only one reference (in passing, with no solution offered).
Thanks for any pointers.I will try at some point but I can't cut down my current app to do it, it's just too large.
However, I did debug the app and I saw what the problem is. My view component, located in (for example) com.xyz.myapp.view, loads several other components, all located in com.xyz.myapp.components. As a result, the Panel component in the View contains (among other directives) xmlns:components="com.xyz.myapp.components.*". Both the namespace variable v and the default xml namespace directive are in a private function in one of the components the main view loads. When I ran the app under the debugger it terminated almost immediately with "Error 1065: variable com.xyz.mypp.components::v is not defined".
That's all I can tell you for now.
Thanks for the reply. -
Hi,
This is a pure xml question. Let me know if there are good forums better suited for this kind of problem.
I receive an xml message with the following format:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<staticMessage xmlns="Static/nme" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="Static/nme ./StaticMessage.xsd">
</staticMessage>I fail to apply transformation when using a stylesheet like:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<xsl:value-of select="staticMessage/body/data"/>
</xsl:template>
</xsl:stylesheet>However if I remove the xmlns attribute in the incoming message (xmlns="Static/nme" ) the transformation works correctly.
I do not have a great understanding of namespaces.
Does anyone know if any special declaration needs to be made for the xsl file to work correctly?
Tx,
Mik.Noticed that declaring a prefix in xsl (xmlns:pre="Static/nme") allows to access nodes or values ( pre:staticData/pre:.../)
But does a prefix need to reference the xml namespace or is it possible to define it as default?
Tx,
Mik. -
Issue with XML namespace and Message structure
Hi All,
I am using Oracle SOA Suite 11.1.1.4. I have SOA web service application one-way messaging wherein I keep receiving messages from the third party. The issue I am facing is with the XML namespaces which conflicts with the third party's message structure. The details are as below.
Our Web-service WSDL*
<schema attributeFormDefault="unqualified" elementFormDefault="qualified"
targetNamespace="http://amb.com/cad/RealTimeService"
xmlns:cad="http://amb.com/cad/RealTimeService"
xmlns:avl="http://schemas.com/asiapac/cad/datamodel/avl/1.0.0"
xmlns:evn="http://schemas.com/asiapac/cad/datamodel/event/1.0.0"
xmlns:uni="http://schemas.com/asiapac/cad/datamodel/unit/1.0.0"
xmlns:dvt="http://schemas.com/asiapac/cad/datamodel/divert/1.0.0"
xmlns:sui="http://schemas.com/asiapac/cad/datamodel/suppinfo/1.0.0"
xmlns="http://www.w3.org/2001/XMLSchema">
<import namespace="http://schemas.com/cad/datamodel/avl/1.0.0"
schemaLocation="AvlCadSchema.xsd"/>
<import namespace="http://schemas.com/cad/datamodel/unit/1.0.0"
schemaLocation="UnitCadSchema.xsd"/>
<import namespace="http://schemas.com/cad/datamodel/event/1.0.0"
schemaLocation="EventCadSchema.xsd"/>
<import namespace="http://schemas.com/cad/datamodel/divert/1.0.0"
schemaLocation="HewsCadSchema.xsd"/>
<import namespace="http://schemas.com/cad/datamodel/suppinfo/1.0.0"
schemaLocation="SupplementalInformationCadSchema.xsd"/>
<element name="AvlAuxData" type="avl:AvlAuxData" nillable="true"/>
<element name="AgencyEvent" type="evn:AgencyEvent"/>
<element name="Diversion" type="dvt:HospitalDiversionMessage"/>
<element name="SupplementalInformation" type="sui:SupplementalInformation"/>
<element name="UnitDetail" type="uni:UnitDetail"/>
</schema>
Using SOAP UI tool a HospitalDiversionMessage Request for the above WSDL will look like*
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:real="http://amb.com/cad/RealTimeService" xmlns:ns="http://schemas.com/cad/datamodel/divert/1.0.0">
<soapenv:Header/>
<soapenv:Body>
<*real*:Diversion>
<ns:Action>?</ns:Action>
<ns:Open>?</ns:Open>
<!--Optional:-->
<ns:Location>?</ns:Location>
<ns:Type>?</ns:Type>
<ns:SubType>?</ns:SubType>
<!--Optional:-->
<ns:ExpiryTimestamp>?</ns:ExpiryTimestamp>
<!--Optional:-->
<ns:Comment>?</ns:Comment>
<!--Optional:-->
<ns:ItemNumber>?</ns:ItemNumber>
<!--Optional:-->
<ns:Notifications>?</ns:Notifications>
<ns:CreatedTerminal>?</ns:CreatedTerminal>
<ns:CreatedTimestamp>?</ns:CreatedTimestamp>
<!--Optional:-->
<ns:ClosedBy>?</ns:ClosedBy>
<!--Optional:-->
<ns:ClosedComments>?</ns:ClosedComments>
<!--Optional:-->
<ns:ClosedTerminal>?</ns:ClosedTerminal>
<!--Optional:-->
<ns:ClosedTimestamp>?</ns:ClosedTimestamp>
</real:Diversion>
</soapenv:Body>
</soapenv:Envelope>
Now the third party sends a HospitalDiversionMessage in this format_
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns0="http://amb.com/cad/RealTimeService" xmlns:ns="http://schemas.com/cad/datamodel/divert/1.0.0">
<soapenv:Header/>
<soapenv:Body>
<ns0:Diversion>
<ns0:Action>?</ns0:Action>
<ns0:Open>?</ns0:Open>
<!--Optional:-->
<ns0:Location>?</ns0:Location>
<ns0:Type>?</ns0:Type>
<ns0:SubType>?</ns0:SubType>
<!--Optional:-->
<ns0:ExpiryTimestamp>?</ns0:ExpiryTimestamp>
<!--Optional:-->
<ns0:Comment>?</ns0:Comment>
<!--Optional:-->
<ns0:ItemNumber>?</ns0:ItemNumber>
<!--Optional:-->
<ns0:Notifications>?</ns0:Notifications>
<ns0:CreatedTerminal>?</ns0:CreatedTerminal>
<ns0:CreatedTimestamp>?</ns0:CreatedTimestamp>
<!--Optional:-->
<ns0:ClosedBy>?</ns0:ClosedBy>
<!--Optional:-->
<ns0:ClosedComments>?</ns0:ClosedComments>
<!--Optional:-->
<ns0:ClosedTerminal>?</ns0:ClosedTerminal>
<!--Optional:-->
<ns0:ClosedTimestamp>?</ns0:ClosedTimestamp>
</ns0:Diversion>
</soapenv:Body>
</soapenv:Envelope>
Questions*
1) I cannot figure out how the SOAPUI tool or SOA substitutes "real" as the namespace prefix for the WSDL based HospitalDiversionMessage and what I need to do at my end to match the message structure as per what the third party needs.
2) I need ns0 namespace prefix to whole of Diversion xml element. Currently it is "real" at top Diversion element and "ns" for its children
Please suggest, I can attach the other imported XSD if need be.
Thanks
Edited by: user5108636 on Jun 13, 2011 6:55 PM
Edited by: user5108636 on Jun 13, 2011 6:57 PM
Edited by: user5108636 on Jun 13, 2011 7:02 PMQuestions
1) I cannot figure out how the SOAPUI tool or SOA substitutes "real" as the namespace prefix for the WSDL based HospitalDiversionMessage and what I need to do at my end to match the message structure as per what the third party needs.The xml namespace suffixes like real and ns0 are just references used by the XML Parsers. For that matter the "real" can be xyz as well.
You dont need to make any changes as long as the xml namespace suffixes refer to the same namespace.
If you see the first soapUI xml and the third party xml have the same namespace references and hence it is not a problem:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:real="*http://amb.com/cad/RealTimeService*" xmlns:ns="http://schemas.com/cad/datamodel/divert/1.0.0">
<soapenv:Header/>
<soapenv:Body>
<*real*:Diversion>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns0="*http://amb.com/cad/RealTimeService*" xmlns:ns="http://schemas.com/cad/datamodel/divert/1.0.0">
<soapenv:Header/>
<soapenv:Body>
<*ns0*:Diversion>
2) I need ns0 namespace prefix to whole of Diversion xml element. Currently it is "real" at top Diversion element and "ns" for its childrenBased on this, logically both the xmls represent the same xml message. And hence you dont need to make any changes.
Please refer to the basics of xml namespaces using the following links:
http://en.wikipedia.org/wiki/XML_namespace
http://zvon.org/comp/r/tut-Namespace.html#Pages~Introduction
Let us know if you still need clarification.
Hope this helps.
Thanks,
Patrick -
XML Namespace and schemalocation property?
In many xml examples i see many nameschemas which even dont use in xml like in below example we have defined nameschemas as xsi,aop and one default
namespace. If we dont use them what the purpose of defining them.Did not attach the xml as its quite big.
Second question is :- Assume that we using this nameschemas..We usually defined the values of namechemas and schemalocation with some web address
like http://someAdddress//. What if we define them with some arbitrary value like ABC or something else. Will it make any differnce? Is there any
processing we do from these web addresses?
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/
schema/beans/spring-beans-2.0.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema
/aop/spring-aop-2.0.xsd">Take a look at these:
http://www.w3.org/TR/REC-xml-names/
http://www.w3.org/TR/xmlschema-1/
http://www.w3.org/TR/xmlschema-2/
Regards,
AK~ -
XML namespace (xmlsn attribute)
Hi to all,
I have a problem, when i build a XML documento in PL/SQL, using xmldom class, i want to set xmlns only in root node.
This is my code:
doc xmldom.DOMDocument;
main_node xmldom.DOMNode;
root_node xmldom.DOMNode;
root_elmt xmldom.DOMElement;
root_elmt_attributato xmldom.DOMElement;
BEGIN
doc := xmldom.newDOMDocument;
main_node := xmldom.makeNode(doc);
root_elmt := xmldom.createElement(doc, 'elencoClienti');
root_node := xmldom.appendChild(main_node, xmldom.makeNode(root_elmt));
xmldom.setAttribute(root_elmt, 'xmlns', 'indirizzo_namespace');
Then i add more than one node to root node, and finally i find in all level-one-parent of a root this attribute
xmlns=""
output example:
<?xml version="1.0" encoding="UTF-8"?>
<elencoClienti xmlns="indirizzo_namespace">
<elenco_pratiche xmlns="">
<rdl>
<id>122</id>
<tipo>PRDL</tipo>
<tran_comm>RDR</tran_comm>
<tipo_lav>TEST</tipo_lav>
<via>Maria Pia</via>
<codice_presa>5003241303200</codice_presa>
<data_protocollo>01/07/2000</data_protocollo>
</rdl>
</elenco_pratiche>
<esito_ricerca xmlns="">
<esito>OKEL</esito>
</esito_ricerca>
</elencoClienti>
both elenco_pratiche and esito_ricerca nodes have attribute xmlns="".
How can i remove that?
Thanks in advance
TeoI would suggest you try applying SP2. There were a few fixes in that SP that
addressed different issues related to getParameter().
Hope that helps.
Shridhar
Navin Garg wrote:
I am using a WLS6.1 sp1 server. I send a request with a parameter having an
xml value say param1=<x y='' /> to a servlet from a java client.
In the servlet when I try to retrieve the value of param1 from the request I
get a null value. The same thing works fine with WLS5.1
Any ideas?
tim -
OC4J orion-application.xml - elements and attributes
Hi. i read in oracle docs sentense like this: "Each property maps to an element attribute in the orion-application.xml descriptor." These properties are from deployment plan and i need to know what is the name of the element in orion-application.xml wich is mapped to webSiteBinding property (from deployment plan).
I just did a quick test of this, and it seems to work for me.
I used the following XML:
<?xml version="1.0" encoding="iso-8859-1"?>
<Employees xmlns="
http://www.foo.com/Employees">
<Employee Id="001">
<LastName>Davis</LastName>
<FirstName>Kirk</FirstName>
</Employee>
<Employee Id="002">
<LastName></LastName>
<FirstName>James</FirstName>
</Employee>
<Employee Id="003">
<FirstName>Anthony</FirstName>
</Employee>
<Employee>
</Employee>
</Employees>
With the XPath "/Employees/Employee" I got rows in the data
set and things displayed fine in my page. Changing it to
"/employees/employee" caused the data set to have no rows which I
would expect since things should be case sensitive.
Can you provide me with some sample XML and XPath that
doesn't work?
Thanks!
--== Kin ==-- -
Configuring XML subnodes and attributes in PDF Template
Hi,
Does anybody know how to configure non-unique XML sub-nodes or XML attributes in a PDF Template? For example, my xml is of below format:
<my-main-node-1 my-attr-1="xyz">
<value>my-value-1</value>
</my-main-node-1>
<my-main-node-2 my-attr-1="abc">
<value>my-value-2</value>
</my-main-node-2>
I want to configure a pdf template textboxes to hold the values
(a) my-main-node-1@my-attr-1
(b) my-main-node-2@my-attr-1
(c) my-main-node-1/value
(d) my-main-node-2/value.
Thanks in advance,
PraveenCan someone on Apps 11.5.10.2 who has applied the patch (I believe it upgrades the server version to 5.6.3) check and see if the behavior I described is the same on their system?
Or can someone tell me if this is expected?
Thanks again. -
Sender SOAP Adapter there is a mandatory field asking for "Default Interface Namespace " and " Default Interface Name ". What should we enter there ?
Does webservices always use Application xml ? How would we find out they are expecting " Application xml " or "content XML" ?
AjithHi Chandran,
This is to reuse the channel for more number of scenarios. If you this default namespace and default interface name in sender channel, then all other scenarios which satisfy this rule(namespace and interface name) can use this channel with out creating new channel.
note:-For SAP PI 7.1, you can have single service interface having multiple operations for each of the message types.
thanks,
madhu -
HI, I am attempting to parse some weather information from the Yahoo weather RSS feed.
This is a typical XML node;
<description>Yahoo! Weather for Palm Springs, CA</description>
I used the typical XML parsing code in as2;
var text1 = this.firstChild.childNodes[0].childNodes[1].firstChild.nodeValue;
txt1.text = text1;
I was doing pretty good until I reached a node that was formatted thus;
<yweather:forecast day="Mon" date="28 Sep 2009" low="74" high="103" text="Sunny" code="32" />
This text traced a value of undefined.
I have tried to research this and so far all I have been able to find out, is that this is a XML namespace and is very easily handled in as3. Unfortunately I have to use as2.
How do I parse out this information into a dyamic text fields?
Or failing that, where in the literature does adobe expalin how this is done?
ForrestHi,
Try this code:
var xmlname:XML = new XML();
xmlname.ignoreWhite = true;
xmlname.load("sample.xml");
xmlname.onLoad = function(sucess:Boolean){
var xNode = xmlname.firstChild;
var tday = xNode.childNodes[0].attributes.day;
var tdate = xNode.childNodes[0].attributes.date;
trace(tdate); -
Draft proposal: Namespaces and CSS
Hey all,
This is a draft proposal for how we'll update CSS support to handle
disambiguating classes via namespace. Feedback appreciated here for now so
when we get to the formal mini-spec we can rush it through.
Keeping in mind that most folks have indicated they don't use Type selectors
much in CSS...
- Namespace qualification is now required for type selectors in CSS style
declarations.
- Gumbo will use the CSS3 suggested syntax for declaring namespaces and
prefixing type selectors. For the most common component namespace the
default namespace can be used (ignore the actual namespace url value):
@namespace "http://ns.adobe.com/flex/spark";
Button { color: #990000; }
Otherwise, prefixes can be specified for each namespace:
@namespace "http://ns.adobe.com/flex/spark";
@namespace cx "com.mycompany.*";
Button { color: #990000; }
cx|MyFancyButton { color: #000099; }
- The namespace mappings that are currently used to map MXML tags to
ActionScript class names will also apply to CSS3 type selectors. These
mappings draw information from configured manifests in flex-config.xml,
swcs' catalog.xml files, and local package namespaces (e.g. how in MXML you
use xmlns:c="com.mycompany.*" to scope the package name for your custom
component). Note that namespace/prefix mappings defined in MXML do not
apply to the enclosing CSS.
- Type selectors that are either not qualified by a namespace or do not
resolve to an ActionScript class linked into the Application cause a warning
at compile time.
- The version compatibility flag forces the compiler to ignore type selector
prefixes. This allows Flex 3 applications to continue to use type selectors
without namespaces.
- The runtime will only match against fully qualified class names going
forward. When the compatibility version flag is set for Flex 3 or earlier,
it only matches against local names.
- When updating from Flex3, applications will either have to run in
compatibility mode, or qualify their CSS type selectors using namespaces. We
continue to discourage type selectors anywhere but the root application
file, and a warning will be given if type selectors are used outside of the
root application.Is modifying the default namespace per file allowed or will it always be
the spark namespace?
Scenario 1.
Styles1.css
@namespace "http://ns.adobe.com/flex/spark";
Button { color: #990000; }
Styles2.css
@namespace "com.effectiveui.controls.*";
SearchButton { color: #990000; }
Scenario 2.
File com/effectiveui/controls/SearchButton.mxml
@namespace "com.effectiveui.controls.*";
SearchButton { color: #990000; }
Are these valid?
Are class selectors scoped to the default/custom namespace and then just
ignored by the style manager implementation, or are they always compiled
into the global space?
Do you expect Flex Builder 4 will provide autocompletion and namespace
insertion when defining type selectors in css files?
Sean Christmann
Matt Chotin wrote:
> A new discussion was started by Matt Chotin in
>
> Developers --
> Draft proposal: Namespaces and CSS
>
> Hey all,
>
> This is a draft proposal for how we'll update CSS support to handle
> disambiguating classes via namespace. Feedback appreciated here for now so
> when we get to the formal mini-spec we can rush it through.
>
> ---------
>
> Keeping in mind that most folks have indicated they don't use Type selectors
> much in CSS...
>
> - Namespace qualification is now required for type selectors in CSS style
> declarations.
> - Gumbo will use the CSS3 suggested syntax for declaring namespaces and
> prefixing type selectors. For the most common component namespace the
> default namespace can be used (ignore the actual namespace url value):
>
> > @namespace "http://ns.adobe.com/flex/spark";
> Button { color: #990000; }
>
>
> Otherwise, prefixes can be specified for each namespace:
>
> > @namespace "http://ns.adobe.com/flex/spark";
> @namespace cx "com.mycompany.*";
>
> Button { color: #990000; }
> cx|MyFancyButton { color: #000099; }
>
>
> - The namespace mappings that are currently used to map MXML tags to
> ActionScript class names will also apply to CSS3 type selectors. These
> mappings draw information from configured manifests in flex-config.xml,
> swcs' catalog.xml files, and local package namespaces (e.g. how in MXML you
> use xmlns:c="com.mycompany.*" to scope the package name for your custom
> component). Note that namespace/prefix mappings defined in MXML do not
> apply to the enclosing CSS.
>
> - Type selectors that are either not qualified by a namespace or do not
> resolve to an ActionScript class linked into the Application cause a warning
> at compile time.
>
> - The version compatibility flag forces the compiler to ignore type selector
> prefixes. This allows Flex 3 applications to continue to use type selectors
> without namespaces.
>
> - The runtime will only match against fully qualified class names going
> forward. When the compatibility version flag is set for Flex 3 or earlier,
> it only matches against local names.
>
> - When updating from Flex3, applications will either have to run in
> compatibility mode, or qualify their CSS type selectors using namespaces. We
> continue to discourage type selectors anywhere but the root application
> file, and a warning will be given if type selectors are used outside of the
> root application.
>
>
>
> ------------------------------------------------------
> View/reply at
> Replies by email are OK.
> Use the unsubscribe form at
to cancel your email subscription.
> .
>
> -
Element name and attribute completion in XML editor?
With either WebLogic Workshop 9.2.2 or 10.x, is it possible to get completion assistance on elements and attributes? It works in the JSP editor, but I need to know whether this will work for XML documents. For some of these namespaces, they are defined in JSF taglibs.
I tested this on an .xhtml doc. Right-clicking gives me these options:
* HTML Editor
* Text Editor
* System Editor
* In-Place Editor
* Default Editor
Is this perhaps a feature available in 10.1? -
Reading XML file and skip certain elements/attributes??
Hi folks!
Suppose I have a XML file looking like this:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE dvds SYSTEM "DTDtest.dtd">
<dvds>
<dvd>
<title>
Aliens
</title>
<director>
James Cameron
</director>
<format>
1.85:1
</format>
</dvd>
<dvd>
<title>
X-Men
</title>
<director>
Bryan Singer
</director>
<format>
2.35:1
</format>
</dvd>
</dvds>
In my Java application I want to read this XML file and print it on the screen (including all tags etc). So far, so good. BUT, if I want to skip certain elements, i.e. all information about the dvd 'X-Men', how am I supposed to do this? In other words, I would like my app to skip reading all information about X-Men and continue with the next <dvd>... </dvd> tag. Is this possible?
My code so far is from the XML tutorial from Sun and it looks like this:
import java.io.*;
import org.xml.sax.*;
import org.xml.sax.helpers.DefaultHandler;
import javax.xml.parsers.SAXParserFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParser;
public class MyXML extends DefaultHandler
public static void main(String argv[]) {
if (argv.length != 1) {
System.err.println("Usage: cmd filename");
System.exit(1);
// Use an instance of ourselves as the SAX event handler
DefaultHandler handler = new MyXML();
// Use the default (non-validating) parser
SAXParserFactory factory = SAXParserFactory.newInstance();
try {
// Set up output stream
out = new OutputStreamWriter(System.out, "UTF8");
// Parse the input
SAXParser saxParser = factory.newSAXParser();
saxParser.parse( new File(argv[0]), handler);
} catch (Throwable t) {
t.printStackTrace();
System.exit(0);
static private Writer out;
//===========================================================
// SAX DocumentHandler methods
//===========================================================
public void startDocument()
throws SAXException
emit("<?xml version='1.0' encoding='UTF-8'?>");
nl();
public void endDocument()
throws SAXException
try {
nl();
out.flush();
} catch (IOException e) {
throw new SAXException("I/O error", e);
* <p>This method prints the start elements including attr.
* @param namespaceURI
* @param lName
* @param qName
* @param attrs
* @throws SAXException
public void startElement(String namespaceURI,
String lName, // local name
String qName, // qualified name
Attributes attrs)
throws SAXException
String eName = lName; // element name
if ("".equals(eName)) eName = qName; // namespaceAware = false
emit("<"+eName);
if (attrs != null) {
for (int i = 0; i < attrs.getLength(); i++) {
String aName = attrs.getLocalName(i); // Attr name
if ("".equals(aName)) aName = attrs.getQName(i);
emit(" ");
emit(aName+"=\""+attrs.getValue(i)+"\"");
emit(">");
public void endElement(String namespaceURI,
String sName, // simple name
String qName // qualified name
throws SAXException
emit("</"+qName+">");
* <p>This method prints the data between 'tags'
* @param buf
* @param offset
* @param len
* @throws SAXException
public void characters(char buf[], int offset, int len)
throws SAXException
String s = new String(buf, offset, len);
emit(s);
//===========================================================
// Utility Methods ...
//===========================================================
// Wrap I/O exceptions in SAX exceptions, to
// suit handler signature requirements
private void emit(String s)
throws SAXException
try {
out.write(s);
out.flush();
} catch (IOException e) {
throw new SAXException("I/O error", e);
// Start a new line
private void nl()
throws SAXException
String lineEnd = System.getProperty("line.separator");
try {
out.write(lineEnd);
} catch (IOException e) {
throw new SAXException("I/O error", e);
Sorry about the long listing... :)
Best regards
/PaulA possibility that comes to mind is to create an XSLT script to do whatever it is you want - and call it from inside the program. The XSLT script can be stashed inside your .jar file by using getClass().getClassLoader().getResource("...")
- David -
XML Payload does not have namespace and prefix.
Hello
I have created a consumer business service which will be called from JDEdwards EOne, pulls data from database and send it to Fusion Middleware.
SO, I have created proxy using JAX-WS option. And suggested in oracle doc, I created proxy outside OMW and then copied it to my project. XML payload is getting generated without namespace and prefix. After some research, I modified package-info.java. Now, I am able to send the payload and if test it locally from Jdeveloper and take xml output using marshaller I can see it has namespace and prefix as well. BUt, when I run this from server it does not have namespace and prefix.
Please help.
Thanks
TKHi Naresh,
The "rejectedMessage" property is for 10G, I am not 100% sure about its implementation in 11G.
In 10G the faulted XML file moves to this location "Oracle_Home\bpel\domains\domain_name\jca\project_directory\rejectedMessages".
This property is used to move the files which are not valid XML or which are not schema compliant. For DB polling I don't think this property is used.
-Yatan
Maybe you are looking for
-
Hello My little brother pressed shift+space+backspace on my N97, and all the data on the phone memory is lost. Is there any way to recover the lost data (Contacts, messages, calendar.....)? I need them urgently. Thanks
-
If i trade in my 3rd Gen ipod touch will i get a discount off a new 4th gen?
Hi i was wondering, At the moment i have a iPod touch 3rd gen and i was wondering if i could trade it in so i could get a 4th gen cheaper, if i can how much money will i save? Thanks
-
Iphone 5.1.1 update
ben iphone u pc ye bağladığımda 5.1 sürümü var güncellemek istermisiniz diyor benim arkadaşlarım güncellemiş ama telefon kilitlenmiş neden kilitleniyor ve o güncelleme yüklenmelimi?
-
Would 100% width on a Fluid Grid Layout be bad for any reason?
I was thinking of setting 100% width on my Fluid Grid Layout (for all media queries) so I wouldn't have to go outside the fluid container for my header and footer bar. Would this be bad for any reason? I feel like they probably preset sizes below 100
-
I have been using Firefox for several years. Now, when I try to open it I get the above error message.