• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // =================================================================================================
2 // ADOBE SYSTEMS INCORPORATED
3 // Copyright 2006 Adobe Systems Incorporated
4 // All Rights Reserved
5 //
6 // NOTICE:  Adobe permits you to use, modify, and distribute this file in accordance with the terms
7 // of the Adobe license agreement accompanying it.
8 // =================================================================================================
9 
10 package com.adobe.xmp.impl;
11 
12 /**
13  * @since   09.11.2006
14  */
15 public class QName
16 {
17 	/** XML namespace prefix */
18 	private String prefix;
19 	/** XML localname */
20 	private String localName;
21 
22 
23 	/**
24 	 * Splits a qname into prefix and localname.
25 	 * @param qname a QName
26 	 */
QName(String qname)27 	public QName(String qname)
28 	{
29 		int colon = qname.indexOf(':');
30 
31 		if (colon >= 0)
32 		{
33 			prefix = qname.substring(0, colon);
34 			localName = qname.substring(colon + 1);
35 		}
36 		else
37 		{
38 			prefix = "";
39 			localName = qname;
40 		}
41 	}
42 
43 
44 	/** Constructor that initializes the fields
45 	 * @param prefix the prefix
46 	 * @param localName the name
47 	 */
QName(String prefix, String localName)48 	public QName(String prefix, String localName)
49 	{
50 		this.prefix = prefix;
51 		this.localName = localName;
52 	}
53 
54 
55 	/**
56 	 * @return Returns whether the QName has a prefix.
57 	 */
hasPrefix()58 	public boolean hasPrefix()
59 	{
60 		return prefix != null  &&  prefix.length() > 0;
61 	}
62 
63 
64 	/**
65 	 * @return the localName
66 	 */
getLocalName()67 	public String getLocalName()
68 	{
69 		return localName;
70 	}
71 
72 
73 	/**
74 	 * @return the prefix
75 	 */
getPrefix()76 	public String getPrefix()
77 	{
78 		return prefix;
79 	}
80 }