/*
 * Copyright 2000-2014 JetBrains s.r.o.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.intellij.psi.xml;

import com.intellij.openapi.util.TextRange;
import com.intellij.psi.PsiNamedElement;
import com.intellij.util.IncorrectOperationException;
import com.intellij.xml.XmlAttributeDescriptor;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

/**
 * @author Mike
 */
public interface XmlAttribute extends XmlElement, PsiNamedElement {
  XmlAttribute[] EMPTY_ARRAY = new XmlAttribute[0];

  @Override
  @NonNls @NotNull String getName();

  @NonNls @NotNull String getLocalName();

  XmlElement getNameElement();

  @NonNls @NotNull String getNamespace();

  @NonNls @NotNull String getNamespacePrefix();

  @Override
  XmlTag getParent();

  /**
   * @return text inside XML attribute with quotes stripped off
   */
  @Nullable
  String getValue();

  /**
   * @return text inside XML attribute with quotes stripped off and XML char entities replaced with corresponding characters
   */
  @Nullable
  String getDisplayValue();

  /**
   * @param offset in string returned by {@link #getText()} (with quotes stripped)
   * @return offset in the string returned from {@link #getDisplayValue()} or -1 if the offset is out of valid range
   */
  int physicalToDisplay(int offset);
  /**
   * @param offset in the string returned from {@link #getDisplayValue()}
   * @return offset in string returned by {@link #getText()} (with quotes stripped) or -1 if the offset is out of valid range
   */
  int displayToPhysical(int offset);

  /**
   * @return TextRange of the XML attribute value.
   * If quotes are present, it returns {@code new TextRange(1, getTextLength()-1)}, otherwise it is {@code new TextRange(0, getTextLength())}
   */
  @NotNull
  TextRange getValueTextRange();

  /**
   * @return true if the attribute is a namespace declaration (its name equals to {@code xmlns} or starts with {@code xmlns:})
   */
  boolean isNamespaceDeclaration();

  @Nullable XmlAttributeDescriptor getDescriptor();

  // In this case function is also used to get references from attribute value
  @Nullable
  XmlAttributeValue getValueElement();

  void setValue(String value) throws IncorrectOperationException;
}

@@ -1097,32 +1097,34 @@
 erride%0A  @NonNls
+%0A 
  @NotNull String
@@ -1108,32 +1108,34 @@
 onNls%0A  @NotNull
+%0A 
  String getName(
@@ -1139,32 +1139,34 @@
 me();%0A%0A  @NonNls
+%0A 
  @NotNull String
@@ -1150,32 +1150,34 @@
 onNls%0A  @NotNull
+%0A 
  String getLocal
@@ -1218,32 +1218,34 @@
 nt();%0A%0A  @NonNls
+%0A 
  @NotNull String
@@ -1229,32 +1229,34 @@
 onNls%0A  @NotNull
+%0A 
  String getNames
@@ -1273,16 +1273,18 @@
  @NonNls
+%0A 
  @NotNul
@@ -1284,16 +1284,18 @@
 @NotNull
+%0A 
  String 
@@ -1690,36 +1690,37 @@
 d by %7B@link #get
-Text
+Value
 ()%7D (with quotes
@@ -1890,16 +1890,17 @@
 ffset);%0A
+%0A
   /**%0A  
@@ -2024,20 +2024,21 @@
 ink #get
-Text
+Value
 ()%7D (wit
@@ -2262,16 +2262,27 @@
 ange(1, 
+getValue().
 getTextL
@@ -2334,16 +2334,27 @@
 ange(0, 
+getValue().
 getTextL
@@ -2601,16 +2601,18 @@
 Nullable
+%0A 
  XmlAttr
@@ -2792,16 +2792,25 @@
 etValue(
+@NotNull 
 String v

fix javadoc typos